Re: [GENERAL] Yet Another (Simple) Case of Index not used

From: "Denis (at) Next2Me" <denis(at)next2me(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Denis" <denis(at)next2me(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [GENERAL] Yet Another (Simple) Case of Index not used
Date: 2003-04-09 00:10:01
Message-ID: EKEBJNAJDPKJBDFGJNIJEENLDBAA.denis@next2me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance pgsql-sql

Interesting generic response. In other words, "it all depends".
Well, a de facto observation is: "In my case, it's always much slower with, say, mysql".
Understand me, I don't mean to be starting a performance comparaison mysql vs postgresql,
which is probably an old subject, I am just looking for a solution to solve this type
of performance issues, ie the generic cases:
select count(*) from addresses where address is like 'pattern%';
Which are very fast on mysql, and very slow on postgresql.
Understood, it will always depend on some parameters, but the real question is: how
much control does one have over those parameters, and how does one tweak them to reach
optimal performance?

D.

> -----Original Message-----
> From: pgsql-performance-owner(at)postgresql(dot)org
> [mailto:pgsql-performance-owner(at)postgresql(dot)org]On Behalf Of Martijn van
> Oosterhout
> Sent: Tuesday, April 08, 2003 4:46 PM
> To: Denis
> Cc: pgsql-performance(at)postgresql(dot)org; pgsql-general(at)postgresql(dot)org;
> pgsql-sql(at)postgresql(dot)org
> Subject: Re: [PERFORM] [GENERAL] Yet Another (Simple) Case of Index not
> used
>
>
> On Tue, Apr 08, 2003 at 12:57:16PM -0700, Denis wrote:
> > The query I am trying to do (fast) is:
> >
> > select count(*) from addresses;
> >
> > This takes more than a second to complete, because, as the 'explain' command
> > shows me,
> > the index created on 'addresses' is not used, and a seq scan is being used.
> > One would assume that the creation of an index would allow the counting of
> > the number of entries in a table to be instantanous?
>
> Incorrect assumption. select count(*) can produce different results in
> different backends depending on the current state of the active
> transactions.
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> > "the West won the world not by the superiority of its ideas or values or
> > religion but rather by its superiority in applying organized violence.
> > Westerners often forget this fact, non-Westerners never do."
> > - Samuel P. Huntington
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2003-04-09 00:16:07 Re: Indexes intersection
Previous Message Martijn van Oosterhout 2003-04-08 23:46:23 Re: Yet Another (Simple) Case of Index not used

Browse pgsql-performance by date

  From Date Subject
Next Message Denis @ Next2Me 2003-04-09 00:21:16 Re: [SQL] Yet Another (Simple) Case of Index not used
Previous Message Martijn van Oosterhout 2003-04-08 23:46:23 Re: Yet Another (Simple) Case of Index not used

Browse pgsql-sql by date

  From Date Subject
Next Message Denis @ Next2Me 2003-04-09 00:21:16 Re: [SQL] Yet Another (Simple) Case of Index not used
Previous Message Martijn van Oosterhout 2003-04-08 23:46:23 Re: Yet Another (Simple) Case of Index not used