Re: [SQL] dynamic events categorization

2008-06-27 Thread Louis-David Mitterrand
On Thu, Jun 26, 2008 at 05:06:14PM +0200, Marc Mamin wrote: Hello, Hi Marc, I guess that the time offsets (now-21 and now-28) are evaluated each time the corresponding condition is met. Excellent suggestion, this makes the query ~ 15% faster. Every bit counts. It may be faster to put

Re: [SQL] dynamic events categorization

2008-06-26 Thread Marc Mamin
Hello, I guess that the time offsets (now-21 and now-28) are evaluated each time the corresponding condition is met. It may be faster to put them into a separate sub query. I'm not sure about putting now itself within the sub query... It may also be better to put your query in a procedure where

[SQL] dynamic events categorization

2008-06-24 Thread Louis-David Mitterrand
Hello, I'm looking for a more efficient way of dynamically categorizing some events. The following view definition looks into each event's latest event_date object (a theater play can have several, a book only one) to tell whether the event is current, past or future: SELECT