pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Bjorn T Johansen <btj@havleik.no>
To: pgsql-general@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Seq scan of table?
Date: Fri, 5 Sep 2003 11:07:12 +0100
Message-ID: <200309051107.12756.dev@archonet.com> (raw)
In-Reply-To: <31414.193.212.14.12.1062751674.squirrel@www.havleik.no>
References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no>
	<31414.193.212.14.12.1062751674.squirrel@www.havleik.no>

On Friday 05 September 2003 09:47, Bjorn T Johansen wrote:
> I think I have found out why.. I have a where clause on a ID field but it
> seems like I need to cast this integer to the same integer as the field is
> defined in the table, else it will do a tablescan.
>
> Is this assumtion correct? And if it is, do I then need to change all my
> sql's to cast the where clause where I just have a number (eg where field
> = 1) to force the planner to use index scan instead of seq scan?

PG's parser will assume an explicit number is an int4 - if you need an int8 
etc you'll need to cast it, yes.
You should find plenty of discussion of why in the archives, but the short 
reason is that PG's type structure is quite flexible which means it can't 
afford to make too many assumptions.

-- 
  Richard Huxton
  Archonet Ltd



view thread (11+ messages)  latest in thread

Message-ID: <200309051107.12756.dev@archonet.com>
Permalink:  ../200309051107.12756.dev@archonet.com/
Also on:    postgresql.org/message-id/200309051107.12756.dev@archonet.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: dev@archonet.com, btj@havleik.no, pgsql-general@postgresql.org
  Subject: Re: [PERFORM] Seq scan of table?
  In-Reply-To: <200309051107.12756.dev@archonet.com>
  References: <58940.193.212.14.12.1062742087.squirrel@www.havleik.no> <31414.193.212.14.12.1062751674.squirrel@www.havleik.no> <200309051107.12756.dev@archonet.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