Skip site navigation (1) Skip section navigation (2)

Optimize slow query

From: "Tyler Durden" <tylersticky(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Optimize slow query
Date: 2007-06-13 11:41:27
Message-ID: ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
Hi,
I've a table with 300 000 records and I'm trying to do a search:

SELECT * FROM addresses WHERE address ILIKE '%Jean Paul%' AND
(l_pc='4250' or r_pc='4250') AND (l_struc='O' or r_struc='O') AND
(prenm ILIKE 'Street')

It performs in 2 seconds in a dual Xeon 2.4mhz with 2Gb of RAM.
I'm using Postgresql 8.1 on ubuntu.
I've indexes on l_pc, r_pc, l_struc,r_struc and prenm (all btrees)
What I'm doing wrong to have such a slow query?

Thanks,
Nuno Mariz

Responses

pgsql-performance by date

Next:From: Cédric VillemainDate: 2007-06-13 11:47:23
Subject: Re: Optimize slow query
Previous:From: Tobias BroxDate: 2007-06-13 10:44:05
Subject: Re: Performance Testing Utility

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group