From: Cédric Villemain <cedric.villemain@dalibo.com>
To: pgsql-performance@postgresql.org
Cc: Tyler Durden <tylersticky@gmail.com>
Subject: Re: Optimize slow query
Date: Wed, 13 Jun 2007 13:47:23 +0200
Message-ID: <200706131350.01695.cedric.villemain@dalibo.com> (raw)
In-Reply-To: <ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com>
References: <ab07320e0706130441y27fa728ei5727436fa9924898@mail.gmail.com>
Le mercredi 13 juin 2007, Tyler Durden a écrit :
> 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?
Could you add 'explain analyze' to your post ?
And how much content have the text fields ? (isn't tsearch2 an option for
you ?)
>
> Thanks,
> Nuno Mariz
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
--
Cédric Villemain
Administrateur de Base de Données
Cel: +33 (0)6 74 15 56 53
http://dalibo.com - http://dalibo.orgAttachments:
signature.asc (application/pgp-signature, 188B) download
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: cedric.villemain@dalibo.com, tylersticky@gmail.com
Subject: Re: Optimize slow query
In-Reply-To: <200706131350.01695.cedric.villemain@dalibo.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