pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@gmail.com>
To: Joost Kraaijeveld <J.Kraaijeveld@askesis.nl>
Cc: Pgsql-Performance <pgsql-performance@postgresql.org>
Subject: Re: How to query and index for customer with lastname and city
Date: Sat, 4 Mar 2006 15:23:08 +0100
Message-ID: <9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com> (raw)
In-Reply-To: <1141481903.10078.14.camel@localhost>
References: <1141466283.6729.17.camel@localhost>
	<9e4684ce0603040549n44e71c29jab72a45f5c440f9@mail.gmail.com>
	<1141481903.10078.14.camel@localhost>

On 3/4/06, Joost Kraaijeveld <J.Kraaijeveld@askesis.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



view thread (5+ messages)  latest in thread

Message-ID: <9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com>
Permalink:  ../9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com/
Also on:    postgresql.org/message-id/9e4684ce0603040623p24f4672bk55a0a303152138aa@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: depesz@gmail.com, J.Kraaijeveld@askesis.nl
  Subject: Re: How to query and index for customer with lastname and city
  In-Reply-To: <9e4684ce0603040623p24f4672bk55a0a303152138aa@mail.gmail.com>
  References: <1141466283.6729.17.camel@localhost> <9e4684ce0603040549n44e71c29jab72a45f5c440f9@mail.gmail.com> <1141481903.10078.14.camel@localhost> <9e4684ce0603040623p24f4672bk55a0a303152138aa@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