From: Mezei Zoltán <mezei.zoltan@telefor.hu>
To: Aaron Bono <postgresql@aranya.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Two optimization questions
Date: Tue, 12 Sep 2006 21:06:03 +0200
Message-ID: <4507051B.1050800@telefor.hu> (raw)
In-Reply-To: <bf05e51c0609121146m52f7899br8dc12140fdbdd05@mail.gmail.com>
References: <45068ABE.8040907@telefor.hu>
<bf05e51c0609121146m52f7899br8dc12140fdbdd05@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mezei.zoltan@telefor.hu, postgresql@aranya.com
Subject: Re: Two optimization questions
In-Reply-To: <4507051B.1050800@telefor.hu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox