pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ogjunk-pgjedan@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Help with a seq scan on multi-million row table
Date: Wed, 10 May 2006 21:53:49 -0400
Message-ID: <26129.1147312429@sss.pgh.pa.us> (raw)
In-Reply-To: <20060511013410.83818.qmail@web50307.mail.yahoo.com>
References: <20060511013410.83818.qmail@web50307.mail.yahoo.com>

<ogjunk-pgjedan@yahoo.com> writes:
> Aha!  set hashjoin=off did the trick.

>                ->  Index Scan using ix_user_url_tag_user_url_id on user_url_tag userurltag0_  (cost=0.00..157.34 rows=103 width=14) (actual time=1.223..1.281 rows=5 loops=1666)
>                      Index Cond: (userurltag0_.user_url_id = "outer".id)

This seems to be the problem right here: the estimate of matching rows
is off by a factor of 20, and that inflates the overall cost estimate
for this plan about the same, causing the planner to think the other way
is cheaper.

What does the pg_stats row for user_url_tag.user_url_id contain?
Have you analyzed that table recently?

			regards, tom lane



view thread (12+ messages)  latest in thread

Message-ID: <26129.1147312429@sss.pgh.pa.us>
Permalink:  ../26129.1147312429@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/26129.1147312429@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ogjunk-pgjedan@yahoo.com
  Subject: Re: Help with a seq scan on multi-million row table
  In-Reply-To: <26129.1147312429@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