pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Luca Fabbro <lfabbro@conecta.it>
Cc: pgsql-admin@postgresql.org
Subject: Re: Index Scan Backward
Date: Mon, 27 Jan 2003 10:17:39 -0500
Message-ID: <26516.1043680659@sss.pgh.pa.us> (raw)
In-Reply-To: <5.2.0.9.0.20030127154857.0231d078@mail.conecta.it>
References: <5.2.0.9.0.20030127140822.02fe5828@mail.conecta.it>
	<5.2.0.9.0.20030127140822.02fe5828@mail.conecta.it>
	<5.2.0.9.0.20030127154857.0231d078@mail.conecta.it>

Luca Fabbro <lfabbro@conecta.it> writes:
>   Limit  (cost=0.00..1003.36 rows=1 width=454) (actual time=806.78..2097.61 
> rows=1 loops=1)
>     ->  Nested Loop  (cost=0.00..392651.18 rows=391 width=454) (actual 
> time=806.77..2097.59 rows=2 loops=1)
>           ->  Index Scan Backward using forum_post_id_key on forum_post 
> p  (cost=0.00..35615.95 rows=60668 width=450) (actual time=0.41..1122.09 
> rows=42322 loops=1)
>           ->  Index Scan using forum_topic_id_key on forum_topic 
> t  (cost=0.00..5.87 rows=1 width=4) (actual time=0.02..0.02 rows=0 loops=42322)
>                 Index Cond: ("outer".topicid = t.id)
>                 Filter: (forumid = 44)
>   Total runtime: 2098.14 msec

Hm.  So the reason this is slow is it has to go back quite far in the id
index before it finds something from forumid 44.  The system is in fact
estimating it as a moderately expensive query --- but not quite
expensive enough.  You might try raising RANDOM_PAGE_COST a little to
see if that brings the cost estimates in line with reality.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <26516.1043680659@sss.pgh.pa.us>
Permalink:  ../26516.1043680659@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26516.1043680659@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lfabbro@conecta.it
  Subject: Re: Index Scan Backward
  In-Reply-To: <26516.1043680659@sss.pgh.pa.us>
  References: <5.2.0.9.0.20030127140822.02fe5828@mail.conecta.it> <5.2.0.9.0.20030127154857.0231d078@mail.conecta.it> <26516.1043680659@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