pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Ken Geis <kgeis@speakeasy.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: bad estimates / non-scanning aggregates
Date: Thu, 28 Aug 2003 22:38:18 -0500
Message-ID: <20030829033818.GA5577@wolff.to> (raw)
In-Reply-To: <3F4EC1D0.5010503@speakeasy.org>
References: <3F4E99F7.7080604@speakeasy.org>
	<20030829025109.GD4373@wolff.to>
	<3F4EBF7E.8020602@speakeasy.org>
	<20030829030156.GF4373@wolff.to>
	<3F4EC1D0.5010503@speakeasy.org>

On Thu, Aug 28, 2003 at 20:00:32 -0700,
  Ken Geis <kgeis@speakeasy.org> wrote:
> Bruno Wolff III wrote:
> >>Not according to the optimizer!  Plus, this is not guaranteed to return 
> >>the correct results.
> >
> >For it to be fast you need an index on (stock_id, price_date) so that
> >you can use an index scan.
> 
> I already said that such an index existed.  In fact, it is the primary 
> key of the table.  And yes, I *am* analyzed!

Your original example didn't actually match that of the table you are showing
examples from. In that example the second half of the primary key was the
date not the end of the day price. If this is the case for the real table,
then that is the reason the distinct on doesn't help.



view thread (6+ messages)

Message-ID: <20030829033818.GA5577@wolff.to>
Permalink:  ../20030829033818.GA5577@wolff.to/
Also on:    postgresql.org/message-id/20030829033818.GA5577@wolff.to

 · 

reply

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: bruno@wolff.to, kgeis@speakeasy.org
  Subject: Re: bad estimates / non-scanning aggregates
  In-Reply-To: <20030829033818.GA5577@wolff.to>

* 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