Re: Performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Diego Schvartzman" <dschvar(at)yahoo(dot)com>
Cc: "Alfred Perlstein" <bright(at)wintelcom(dot)net>, "Lista PGSQL" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Performance
Date: 2000-05-16 22:22:04
Message-ID: 14736.958515724@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Diego Schvartzman" <dschvar(at)yahoo(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lorien 2000-05-16 23:15:17 Re: HTML version of book fixed
Previous Message Dragos Stoichita 2000-05-16 22:08:04 Re:Am I really stupid???