pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tyler Durden <tylersticky@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Optimize slow query
Date: Wed, 13 Jun 2007 12:41:27 +0100
Message-ID: <ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com>
Permalink:  ../ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com/
Also on:    postgresql.org/message-id/ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tylersticky@gmail.com
  Subject: Re: Optimize slow query
  In-Reply-To: <ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox