query optimiser changes 6.5->7.0 - Mailing list pgsql-general

From Simon Hardingham
Subject query optimiser changes 6.5->7.0
Date
Msg-id 4DCB16536FCBD311897000A0C92A02ED19FA62@sauron.netxtra.net
Whole thread Raw
Responses Re: query optimiser changes 6.5->7.0  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi,

I apologise if I am being stupid or this is the wrong list, but here goes
anyway ;-)

I have a table of the following form:

           Table "gazet"
 Attribute |    Type     | Modifier
-----------+-------------+----------
 country   | integer     |
 name      | varchar(30) |
 lat       | float4      |
 long      | float4      |
 score     | integer     |
Index: gazet_index

gazet_index is an index defined as

create index gazet_index on gazet (country)

This table has a couple of million rows and I am executing the query:-

select * from gazet where country=1 and lower(name) = 'placename';

I have been running this with no problems on Postgres 6.5.1 and this query
takes about a second. I have now set-up a dedicated Postgres server using
version 7.0 and exported the entire database into it using a pg_dump.  I
have then run vacuum to recreate indexes etc, but the query takes 7-8
seconds now.  I have run explain on the query and it shows that it is just
performed a sequential scan on version 7.0

Seq Scan on gazet  (cost.....)

On the old version (6.5.1) it reports

Index Scan using gazet_index on gazet  (cost=....

Any suggestions as to how I can improve performance on this databases new
server?

Many thanks

Simon


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/         Simon Hardingham - netXtra Ltd - UK          _/
_/ Tel: +44 (0) 1787 319393    Fax: +44 (0) 1787 319394 _/
_/ http://www.netxtra.co.uk         simon@netxtra.co.uk _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postmaster won't -HUP
Next
From: Steve Wampler
Date:
Subject: Re: ALTERING A TABLE