Re: Two optimization questions
| От | Mezei Zoltán |
|---|---|
| Тема | Re: Two optimization questions |
| Дата | |
| Msg-id | 4507051B.1050800@telefor.hu обсуждение |
| Ответ на | Re: Two optimization questions ("Aaron Bono" <postgresql@aranya.com>) |
| Список | 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
В списке pgsql-sql по дате отправления: