pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nis Jørgensen <nis@superlativ.dk>
To: pgsql-performance@postgresql.org
Subject: Re: Seqscan
Date: Tue, 23 Oct 2007 15:36:21 +0200
Message-ID: <ffktcs$sbk$1@ger.gmane.org> (raw)
In-Reply-To: <766975.88585.qm@web50908.mail.re2.yahoo.com>
References: <1193107511.26301.59.camel@jdavis>
	<766975.88585.qm@web50908.mail.re2.yahoo.com>

(Please don't top-post. )

Adrian Demaestri skrev:
> */Jeff Davis <pgsql@j-davis.com>/* escribió:
> 
>     On Mon, 2007-10-22 at 19:24 -0700, Adrian Demaestri wrote:
>     > Hi,
>     > I think planner should use other plans than seqscan to solve querys
>     > like select * from hugetable limit 1, especially when the talbe is
>     > very large. Is it solved in newer versions or is there some open
>     > issues about it?.
>     > thanks
>     > I'm working with postgres 8.0.1,
> 
>     For the query in question, what would be faster than a seqscan? It
>     doesn't read the whole table, it only reads until it satisfies the limit
>     clause.

> It is not actualy a table, sorry, it is a quite complex view that
> involve three large tables.


If hugetable isn't a table, you chose a really bad name for it.

What you have here is a specific query performing badly, not a generic
issue with all queries containing "LIMIT X". You might of course have
found a construct which the planner has problems with - but the first
step is to let us see the result of EXPLAIN ANALYZE.

Anyway, I think you might be hitting this issue:

"Fix mis-planning of queries with small LIMIT values due to poorly
thought out "fuzzy" cost comparison"
(http://www.postgresql.org/docs/8.0/static/release-8-0-4.html)

which was fixed in 8.0.4 . You should upgrade.

Nis




view thread (4+ messages)

Message-ID: <ffktcs$sbk$1@ger.gmane.org>
Permalink:  ../ffktcs$sbk$1@ger.gmane.org/
Also on:    postgresql.org/message-id/ffktcs$sbk$1@ger.gmane.org

 · 

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: nis@superlativ.dk
  Subject: Re: Seqscan
  In-Reply-To: <ffktcs$sbk$1@ger.gmane.org>

* 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