From: Merlin Moncure <mmoncure@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: is it possible to make this faster?
Date: Fri, 26 May 2006 13:46:30 -0400
Message-ID: <b42b73150605261046w78e48f72j5f080db0e4ee5370@mail.gmail.com> (raw)
In-Reply-To: <27137.1148663259@sss.pgh.pa.us>
References: <b42b73150605251307id0e7998td4a3693f0d456f88@mail.gmail.com>
<15919.1148590347@sss.pgh.pa.us>
<16119.1148591497@sss.pgh.pa.us>
<b42b73150605252147h218ec25ci183283334731adbd@mail.gmail.com>
<25668.1148653358@sss.pgh.pa.us>
<b42b73150605260956h30a960efl39d75601d5767747@mail.gmail.com>
<27137.1148663259@sss.pgh.pa.us>
On 5/26/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Merlin Moncure" <mmoncure@gmail.com> writes:
> > did you have a key on a,b,c?
> Yeah, I did
> create index t1i on t1 (a,b,c);
> Do I need to use some other syntax to get it to work?
can't thing of anything, I'm running completely stock, did you do a
optimize table foo? is the wind blowing in the right direction?
> > select count(*) from (select a,b,max(c) group by a,b) q;
> > blows the high performance case as does putting the query in a view.
> I noticed that too, while trying to suppress the returning of the
> results for timing purposes ... still a few bugs in their optimizer
> obviously. (Curiously, EXPLAIN still claims that the index is being
> used.)
well, they do some tricky things pg can't do for architectural reasons
but the special case is obviously hard to get right. I suppose this
kinda agrues against doing all kinds of acrobatics to optimize mvcc
weak cases like the above and count(*)...better to make heap access as
quick as possible.
> > mysql> select user_id, acc_id, max(sample_date) from usage_samples group by 1,2
> > 939 rows in set (0.07 sec)
> > mysql> select user_id, acc_id, max(sample_date) from usage_samples group by 1,2
> > 939 rows in set (1.39 sec)
oops, pasted the wrong query..case 2 should have been
select user_id, acc_id, max(sample_date), disksize from usage_samples
group by 1,2
illustrating what going to the heap does to the time.
merlin
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-performance@postgresql.org
Cc: mmoncure@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: is it possible to make this faster?
In-Reply-To: <b42b73150605261046w78e48f72j5f080db0e4ee5370@mail.gmail.com>
* 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