Re: Two optimization questions - Mailing list pgsql-sql

From Mezei Zoltán
Subject Re: Two optimization questions
Date
Msg-id 4507051B.1050800@telefor.hu
Whole thread Raw
In response to Re: Two optimization questions  ("Aaron Bono" <postgresql@aranya.com>)
List 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 by date:

Previous
From: "Aaron Bono"
Date:
Subject: Re: Two optimization questions
Next
From: Emi Lu
Date:
Subject: How to get all users under a group