pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <Inoue@tpf.co.jp>
To: Daniel Kalchev <daniel@digsys.bg>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: again on index usage
Date: Wed, 09 Jan 2002 18:45:22 +0900
Message-ID: <3C3C1132.E51307CF@tpf.co.jp> (raw)
References: <200201090745.JAA15141@dcave.digsys.bg>

Daniel Kalchev wrote:
> 
> >>>Tom Lane said:
>  > Daniel Kalchev <daniel@digsys.bg> writes:
>  > > Same result (sorry, should have included this originally):
>  >
>  > >>> If you say "set enable_seqscan to off", does that change the plan?
>  >
>  > > Aggregate  (cost=100359.71..100359.71 rows=1 width=8)
>  > >   ->  Index Scan using iplog_gate200112_ipdate_idx on iplog_gate200112
>  > > (cost=0.00..100217.52 rows=56873 width=8)
>  >
>  > So, what we've got here is a difference of opinion: the planner thinks
>  > that the seqscan will be faster.  How many rows are actually selected
>  > by this WHERE clause?  How long does each plan actually take?
>  >
>  >                      regards, tom lane
> 
> 3-5 minutes with sequential scan; 10-15 sec with index scan. The query returns
> 4062 rows. Out of ca 1700000 rows.
> 
> With only the datetime constraints (which relates to the index), the number of
> rows is 51764.

The planner estimates 56873 rows. It seems not that bad.
A plausible reason is your table is nearly clustered 
as to ipdate.

regards,
Hiroshi Inoue



view thread (48+ messages)  latest in thread

Message-ID: <3C3C1132.E51307CF@tpf.co.jp>
Permalink:  ../3C3C1132.E51307CF@tpf.co.jp/
Also on:    postgresql.org/message-id/3C3C1132.E51307CF@tpf.co.jp

 · 

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-hackers@postgresql.org
  Cc: Inoue@tpf.co.jp, daniel@digsys.bg, tgl@sss.pgh.pa.us
  Subject: Re: again on index usage
  In-Reply-To: <3C3C1132.E51307CF@tpf.co.jp>

* 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