From: | Mezei Zoltán <mezei(dot)zoltan(at)telefor(dot)hu> |
---|---|
To: | Aaron Bono <postgresql(at)aranya(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Two optimization questions |
Date: | 2006-09-12 19:06:03 |
Message-ID: | 4507051B.1050800@telefor.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Emi Lu | 2006-09-12 19:24:49 | How to get all users under a group |
Previous Message | Aaron Bono | 2006-09-12 18:46:30 | Re: Two optimization questions |