Re: How to query and index for customer with lastname and city

From: "hubert depesz lubaczewski" <depesz(at)gmail(dot)com>
To: "Joost Kraaijeveld" <J(dot)Kraaijeveld(at)askesis(dot)nl>
Cc: Pgsql-Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: How to query and index for customer with lastname and city
Date: 2006-03-04 14:23:08
Message-ID: 9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 3/4/06, Joost Kraaijeveld <J(dot)Kraaijeveld(at)askesis(dot)nl> wrote:
> > how many record do you have in the customers table?
> 368915 of which 222465 actually meet the condition.
> >From what I understand from the mailing list, PostgreSQL prefers a table
> scan whenever it expects that the number of records in the resultset
> will be ~ > 10 % of the total number of records in the table. Which
> explains the table scan for customers, but than again, it does not
> explain why it uses the index on addresses: it has 369337 addresses of
> which 158003 meet the condition

bitmap index scan is faster than sequential table scan. that's all. it
was introduced in 8.1 as far as i remember.
basically - i doubt if you can get better performace from query when
the result row-count is that high.

out of curiosity though - why do you need so many rows? it's not
possible to view them, nor do anything meaningful with 200 thousand
rows!

depesz

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-03-04 15:46:05 Re: Bad row estimates
Previous Message Joost Kraaijeveld 2006-03-04 14:18:23 Re: How to query and index for customer with lastname