pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alessandro Baretta <a.baretta@barettadeit.com>
Cc: Matteo Beccati <php@beccati.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: 500x speed-down: Wrong query plan?
Date: Mon, 09 Jan 2006 13:56:50 -0500
Message-ID: <6914.1136833010@sss.pgh.pa.us> (raw)
In-Reply-To: <43C2B06B.4050506@barettadeit.com>
References: <43C26A5F.7040702@barettadeit.com>
	<43C27AFA.7060604@beccati.com>
	<43C28DEA.60801@barettadeit.com>
	<6719.1136832065@sss.pgh.pa.us>
	<43C2B06B.4050506@barettadeit.com>

Alessandro Baretta <a.baretta@barettadeit.com> writes:
> Tom Lane wrote:
>> I'm curious to see how many rows the planner thinks this will produce,
>> and whether it will use the index or not.

> dmd-freerp-1-alex=# EXPLAIN ANALYZE SELECT * FROM articolo WHERE 
> articolo.xdbs_modified > '2006-01-08 18:25:00+01';
>                                                                  QUERY PLAN
> -------------------------------------------------------------------------------------------------------------------------------------------
>   Index Scan using articolo_modified_index on articolo  (cost=0.00..3914.91 
> rows=17697 width=653) (actual time=0.032..0.032 rows=0 loops=1)
>     Index Cond: (xdbs_modified > '2006-01-08 18:25:00'::timestamp without time zone)
>   Total runtime: 0.150 ms
> (3 rows)

Well, there's your problem: 17697 rows estimated vs 0 actual.  With a
closer row estimate it would've probably done the right thing for the
join problem.

How many rows are really in the table, anyway?  Could we see the
pg_stats row for articolo.xdbs_modified?

			regards, tom lane



view thread (7+ messages)

Message-ID: <6914.1136833010@sss.pgh.pa.us>
Permalink:  ../6914.1136833010@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6914.1136833010@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, a.baretta@barettadeit.com, php@beccati.com
  Subject: Re: 500x speed-down: Wrong query plan?
  In-Reply-To: <6914.1136833010@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