pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bjørn T Johansen <btj@havleik.no>
To: pgsql-general@postgresql.org
To: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Seq scan of table?
Date: Fri, 05 Sep 2003 15:23:24 +0200
Message-ID: <1062768204.11199.23.camel@pennywise.havleik.no> (raw)
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>

On Fri, 2003-09-05 at 12:07, Richard Huxton wrote:
> 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.

Oki, I am using both int2 and int8 as well, so that explains it...
Thanks!


BTJ






view thread (11+ messages)  latest in thread

Message-ID: <1062768204.11199.23.camel@pennywise.havleik.no>
Permalink:  ../1062768204.11199.23.camel@pennywise.havleik.no/
Also on:    postgresql.org/message-id/1062768204.11199.23.camel@pennywise.havleik.no

 · 

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: btj@havleik.no, pgsql-general@postgresql.org
  Subject: Re: [PERFORM] Seq scan of table?
  In-Reply-To: <1062768204.11199.23.camel@pennywise.havleik.no>
  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> <1062768204.11199.23.camel@pennywise.havleik.no>

* 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