Re: Performance - Mailing list pgsql-general

From Tom Lane
Subject Re: Performance
Date
Msg-id 14736.958515724@sss.pgh.pa.us
Whole thread Raw
In response to Re: Performance  ("Diego Schvartzman" <dschvar@yahoo.com>)
List pgsql-general
"Diego Schvartzman" <dschvar@yahoo.com> writes:
> 50000 ROWS  aprox
> INDEX:
> create index d_cue_clave on d_cue (clave);
> EXPLAIN:
> ra1999=> explain select * from d_cue where clave='9400001';
> NOTICE:  QUERY PLAN:
> Seq Scan on d_cue  (cost=0.00..3738.62 rows=1 width=544)

Wow, that's looking pretty peculiar.  The thing's estimating only one
row out, so it's not being fooled by bad statistics or anything like
that.  It surely ought to pick an indexscan here.  The only thing I can
think of is that somehow it's not realizing that the index can be
applied for this query --- but I don't see why not.  I think you've
stumbled across a very strange bug.  What EXPLAIN output do you get if
you first do
    SET enable_seqscan = OFF;
That should force it to pick an indexscan if it can figure out how...

If you still get a seqscan even in that case, I'd like to trouble you
for the result of EXPLAIN VERBOSE on the query.  You can reduce the
verbosity without (probably) changing the results if you just select
one column instead of all of 'em, ie
    explain verbose select clave from d_cue where clave='9400001';

            regards, tom lane

pgsql-general by date:

Previous
From: Dragos Stoichita
Date:
Subject: Re:Am I really stupid???
Next
From: "Lorien"
Date:
Subject: Re: HTML version of book fixed