Re: sql query not using indexes - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: sql query not using indexes
Date
Msg-id Pine.BSF.4.10.10009201122040.57382-100000@megazone23.bigpanda.com
Whole thread Raw
In response to sql query not using indexes  (User Lenzi <lenzi@k1.com.br>)
Responses Re: sql query not using indexes
List pgsql-sql
On Wed, 20 Sep 2000, User Lenzi wrote:

> if I start a query:
> 
> explain select * from teste where login = 'xxx'
> results:
> Index  Scan using  teste1 on teste (cost=0.00..97.88 rows=25 )
> 
> 
> however a query:
> explain select * from teste where login > 'AAA'
> results:
> Seq Scan on teste ....
> 
> 
> On a machine running version 6.5 both queries results index scan.
> 
> this results that the version 6.5 is faster than version 7.0.2 on this
> kind of
> query.
> 
> 
> Any explanation???

Have you done a vacuum analyze on the table?  Also, what does the row
count for the second query look like?  It's probably deciding that
there are too many rows that will match login >'AAA' for index scan
to be cost effective.  So, actually, also, what does
select count(*) from teste where login>'AAA" give you on the 7.0.2 box.




pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: [GENERAL] Foreign Keys Help Delete!
Next
From: Louis-David Mitterrand
Date:
Subject: Re: [Fwd: Re: no ORDER BY in subselects?]