Page 1 of 1
SELECT within range or set active = 0 if out of range
Posted: Fri Jul 06, 2007 4:20 pm
by Luke
We're setting up a job listing application (ReverandDexter & I). In the application you can set when your listing should expire. Does it make more sense to SET active = 0 if expiration date > NOW() or does it make more sense to just add a WHERE expire_date < NOW() to all of my select queries?
Posted: Fri Jul 06, 2007 5:10 pm
by superdezign
The WHERE clause is faster.
But if you plan to delete the expired listings, I'd go for the first method.
Posted: Fri Jul 06, 2007 5:19 pm
by Luke
We plan on just not showing the posts if they are expired. I don't think that we plan on deleting them at any time.
Posted: Fri Jul 06, 2007 5:42 pm
by ReverendDexter
For a little more insight into the debate, I'm a staunch advocate of the "setting active = 0" strategy. Using that, a user will never run into the situation where their job post is "active", but not displaying. Also, it makes it very easy for a user to get their job back on the board (just reactivate it) when it comes off (if they so choose to relist).
I agree that the where clause method is much faster, I just don't agree that it's *better*.
Posted: Fri Jul 06, 2007 5:47 pm
by Luke
and I'm not sure either way... hence the thread LOL