Re: Optimize slow query

From: "Tyler Durden" <tylersticky(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimize slow query
Date: 2007-06-13 11:49:07
Message-ID: ab07320e0706130449x48258f55t40ebc6521501107d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 6/13/07, Tyler Durden <tylersticky(at)gmail(dot)com> wrote:
> 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
>

My bad!
Sorry, I've missed an index on l_struc and r_struc.

Thanks, anyway.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Michael Dengler 2007-06-13 13:35:27 WAL shipping and ever expanding pg_xlog
Previous Message Cédric Villemain 2007-06-13 11:47:23 Re: Optimize slow query