Re: select slow?

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Jaime Casanova" <el_vigia_ec(at)hotmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: select slow?
Date: 2004-03-31 08:33:24
Message-ID: 200403310933.24397.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tuesday 30 March 2004 20:25, Jaime Casanova wrote:
> hi all,
>
>
> i have an amd athlon with 256 ram (i know, this is not a *real* server but
> my tables are small)

Nothing wrong with it - it's what I still use as my development server.

> i'm using vb6 (win98) with pgsql-7.3.4 (rh8) trough the psqlodbc.
>
> when i do a select in took long to execute, here is an example

> CREATE TABLE ICC_M_BANCO (
> CodBanco SMALLINT NOT NULL,

> select * from icc_m_banco where codbanco = 1;
>
> it tooks 13s from it's send until it's executed.

Try:
SELECT * FROM icc_m_banco WHERE codbanco = 1::smallint;

By default, PG will treat a numeric constant as integer not smallint, so when
it looks for an index it can't find one for integer, so scans instead.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Priem, Alexander 2004-03-31 09:51:02 What index for 'like (%keyword%)' ???
Previous Message Tom Lane 2004-03-31 05:33:51 Re: LIKE should use index when condition doesn't include