From: Mark Lewis <mark.lewis@mir3.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Merlin Moncure <mmoncure@gmail.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: is it possible to make this faster?
Date: Thu, 25 May 2006 14:26:23 -0700
Message-ID: <1148592384.9750.13.camel@archimedes> (raw)
In-Reply-To: <15919.1148590347@sss.pgh.pa.us>
References: <b42b73150605251307id0e7998td4a3693f0d456f88@mail.gmail.com>
<15919.1148590347@sss.pgh.pa.us>
On Thu, 2006-05-25 at 16:52 -0400, Tom Lane wrote:
> "Merlin Moncure" <mmoncure@gmail.com> writes:
> > been doing a lot of pgsql/mysql performance testing lately, and there
> > is one query that mysql does much better than pgsql...and I see it a
> > lot in normal development:
>
> > select a,b,max(c) from t group by a,b;
>
> > t has an index on a,b,c.
>
> The index won't help, as per this comment from planagg.c:
>
> * We don't handle GROUP BY, because our current implementations of
> * grouping require looking at all the rows anyway, and so there's not
> * much point in optimizing MIN/MAX.
>
> Given the numbers you mention (300k rows in 2000 groups) I'm not
> convinced that an index-based implementation would help much; we'd
> still need to fetch at least one record out of every 150, which is
> going to cost near as much as seqscanning all of them.
Well, if the MySQL server has enough RAM that the index is cached (or
index + relevant chunks of data file if using InnoDB?) then that would
explain how MySQL can use an index to get fast results.
-- Mark Lewis
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: mark.lewis@mir3.com, tgl@sss.pgh.pa.us, mmoncure@gmail.com
Subject: Re: is it possible to make this faster?
In-Reply-To: <1148592384.9750.13.camel@archimedes>
* 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