pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jason Earl <jason.earl@simplot.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: Jean-Christophe Boggio <cat@thefreecat.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Optimization with dates
Date: 13 Nov 2001 17:49:45 -0700
Message-ID: <87bsi6jhw6.fsf@npa01zz001.simplot.com> (raw)
In-Reply-To: <web-505462@davinci.ethosmedia.com>
References: <web-505462@davinci.ethosmedia.com>


Yikes!  Good catch.  My example database returns on ~.6M for the last
30 days, and an index scan still turns out to be a win (of course, it
turned out to be a bigger win to have a separate table with 15 minute
summarizations of the data :).

Josh is right, chances are good that a sequential scan will actually
perform better for you than an index scan if you are returning 20% of
your entire table.

Jason

"Josh Berkus" <josh@agliodbs.com> writes:

> Jean-Christophe,
> 
> > Aggregate  (cost=256546.78..256546.78 rows=1 width=0)
> >   ->  Seq Scan on gains  (cost=0.00..250627.68 rows=2367640 width=0)
> > 
> > whereas :
> 
> Hmmm... if the number of rows is actually accurate (2M out of 10M in the
> last 30 days) then a Seq Scan seems like a good plan to me.  If the
> numbers aren't accurate, it's time to run a VACUUM ANALYZE.
> 
> Regardless, if you're actually querying for 2M recordsets, you'd better
> throw some hardware at the problem, and learn the .conf parameters.
> 
> -Josh
> 
> ______AGLIO DATABASE SOLUTIONS___________________________
>                                        Josh Berkus
>   Complete information technology      josh@agliodbs.com
>    and data management solutions       (415) 565-7293
>   for law firms, small businesses        fax 621-2533
>     and non-profit organizations.      San Francisco
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org



view thread (11+ messages)  latest in thread

Message-ID: <87bsi6jhw6.fsf@npa01zz001.simplot.com>
Permalink:  ../87bsi6jhw6.fsf@npa01zz001.simplot.com/
Also on:    postgresql.org/message-id/87bsi6jhw6.fsf@npa01zz001.simplot.com

 · 

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-sql@postgresql.org
  Cc: jason.earl@simplot.com, josh@agliodbs.com, cat@thefreecat.org
  Subject: Re: Optimization with dates
  In-Reply-To: <87bsi6jhw6.fsf@npa01zz001.simplot.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