From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pierre-Frédéric Caillaud <lists@boutiquenumerique.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: sequential scan on select distinct
Date: Thu, 07 Oct 2004 11:35:34 -0400
Message-ID: <29074.1097163334@sss.pgh.pa.us> (raw)
In-Reply-To: <opsfh00bfrcq72hf@musicbox>
References: <200410061130.58625.ole@freiheit.com>
<opsff1mmp8cq72hf@musicbox>
<874ql7ztnb.fsf@stark.xeocode.com>
<29194.1097091506@sss.pgh.pa.us>
<opsfh00bfrcq72hf@musicbox>
=?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= <lists@boutiquenumerique.com> writes:
> Present state is that DISTINCT and UNION are slow with or without using
> the GROUP BY trick. Including the index skip scan in the planning options
> would only happen when appropriate cases are detected. This detection
> would be very fast.
You have no basis whatever for making that last assertion; and since
it's the critical point, I don't intend to let you slide by without
backing it up. I think that looking for relevant indexes would be
nontrivial; the more so in cases like you've been armwaving about just
above, where you have to find a relevant index for each of several
subqueries. The fact that the optimization wins a lot when it wins
is agreed, but the time spent trying to apply it when it doesn't work
is a cost that has to be set against that. I don't accept your premise
that every query for which skip-index isn't relevant is so slow that
planning time does not matter.
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, lists@boutiquenumerique.com
Subject: Re: sequential scan on select distinct
In-Reply-To: <29074.1097163334@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