From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vlad Marchenko <vlad@infonet.com.ua>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] "Group by" and "index".
Date: Sun, 30 Jan 2000 17:29:41 -0500
Message-ID: <497.949271381@sss.pgh.pa.us> (raw)
In-Reply-To: <008801bf6b68$4b212f20$2d7a01d4@kuzja>
References: <008801bf6b68$4b212f20$2d7a01d4@kuzja>
"Vlad Marchenko" <vlad@infonet.com.ua> writes:
>> explain select field1 from test group by field1;
> It don't use this index :-(.
That's a deficiency of the 6.5 planner; it won't consider an indexscan
unless there's a WHERE clause that matches the index. This is fixed for
7.0.
However, the 6.5 planner is not necessarily doing the wrong thing here!
Replacing the explicit sort with an index scan could easily produce a
slower query. Index scans are good for pulling out a few items,
but when you are going to end up fetching the whole table, they are
pretty slow because of the nonsequential disk accesses they cause.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, vlad@infonet.com.ua
Subject: Re: [SQL] "Group by" and "index".
In-Reply-To: <497.949271381@sss.pgh.pa.us>
References: <008801bf6b68$4b212f20$2d7a01d4@kuzja> <497.949271381@sss.pgh.pa.us>
* 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