Re: Postgresql is very slow

From: "Ian Barwick" <barwick(at)gmail(dot)com>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: bijayant4u(at)yahoo(dot)com, tv(at)fuzzy(dot)cz, pgsql-performance(at)postgresql(dot)org
Subject: Re: Postgresql is very slow
Date: 2008-06-24 09:33:10
Message-ID: 1d581afe0806240233p27f31f41h9b4b58f6db4a50c7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2008/6/24 Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>:
> On Mon, Jun 23, 2008 at 11:48 PM, bijayant kumar <bijayant4u(at)yahoo(dot)com> wrote:
(...)
>> The output of EXPLAIN query;
>>
>> select * from USERS where email like '%bijayant.kumar%';
>> This simplest query tooks 10 minutes and server loads goes from 0.35 to 16.94.
>>
>> EXPLAIN select * from USERS where email like '%bijayant.kumar%';
>> QUERY PLAN
>> --------------------------------------------------------------
>> Seq Scan on USERS (cost=0.00..54091.84 rows=1 width=161)
>> Filter: ((email)::text ~~ '%bijayant.kumar%'::text)
>> (2 rows)
>
> You're scanning ~ 54094 sequential pages to retrieve 1 row. Note
> that explain analyze is generally a better choice, it gives more data
> useful for troubleshooting.
>
> Definitely need a vacuum full on this table, likely followed by a reindex.

This is a LIKE query with a wildcard at the start of the string to
match, reindexing won't help much.

Ian Barwick

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message tv 2008-06-24 10:02:08 Re: Postgresql is very slow
Previous Message bijayant kumar 2008-06-24 09:17:34 Re: Postgresql is very slow