Re: Table scan instead of index scan

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Mário Sérgio G Antunes <mariosergioa(at)msantunes(dot)com(dot)br>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Table scan instead of index scan
Date: 2001-07-24 13:34:19
Message-ID: Pine.BSF.4.21.0107240630430.68012-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 24 Jul 2001, [ISO-8859-1] Mrio Srgio G Antunes wrote:

> I use PostgreSQL 7.1.2.4 in two servers under RedHat 7.0.
> Our database has a table like that:
> create table tb_client
> (
> id_client varchar(32),
> client_name varchar(40),
> bdate date,
> ...
> );
>
> create index xiftb_client on tb_client(id_client);
>
> When I execute the following query:
>
> SELECT * FROM tb_cliente WHERE id_client LIKE '1234%';
>
> One server executes index search and other full table scan.
>
> I don't know the reason.
>
> If you could help me I would appreciate a lot.

There are a few possibilities. Are both servers vacuum analyzed?
Are both compiled the same way? Are both running in the same locale
and what is it (which affects like optimization)? What is explain's row
estimates on the two machines (if one is much larger percentage of the
table than the other, that'd also force a table scan)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto João Lopes Garcia 2001-07-24 13:50:50 How to get the server version??
Previous Message Bhuvan A 2001-07-24 13:33:55 Re: how can we get total records in pg server?