Aaron Bono wrote:
You could split it into sub-queries but would that make the performance better or worse? I guess it depends on how much data is there, and what frequency you have ot the event_type's but indexing the event_type column would help. This may be worth a try - use EXPLAIN to see which is better.

Yep, I tought of that, but the solution with having is faster now. I think it is because about 30% of the rows are selected in the subquery now. Later we will have more records, and the subselect should select only about 1-2% of the rows. At that time, I think your solution will be faster.

Questions like this come up frequently and there are some nice solutions:

See if this gives you some insight:

select
    '2006-01-15'::date + s.inc
from
generate_series(0, ('2006-02-20'::date - '2006-01-15'::date)::integer) as s(inc)
Sup, that's just what I needed. Thank you.

Zizi

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to