pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
To: pgsql-performance@postgresql.org
Subject: Re: optimizing Postgres queries
Date: Mon, 5 Jan 2004 18:07:53 +0530
Message-ID: <200401051806.27496.shridhar_daithankar@myrealbox.com> (raw)
In-Reply-To: <3796212E-3F79-11D8-A528-000A95A6F0DC@cluster9.com>
References: <4B0023AC-3F72-11D8-B3EB-000A95A6F0DC@cluster9.com>
	<200401051740.05006.shridhar_daithankar@myrealbox.com>
	<3796212E-3F79-11D8-A528-000A95A6F0DC@cluster9.com>

On Monday 05 January 2004 17:48, David Teran wrote:
> Hi,
>
> > The performance will likely to be the same. Its just that integer
> > happens to
> > be default integer type and hence it does not need an explicit
> > typecast. ( I
> > don't remember exactly which integer is default but it is either of
> > int2,int4
> > and int8...:-))
>
> The docs say int4 is much faster than int8, but i will check this.

Well yes. That is correct as well. 

What I (really) meant to say that an index scan to pick few in4 tuples 
wouldn't be hell much faster than an index scan to pick same number of tuples 
with int8 definition. 

The initial boost you got from converting to index scan, would be probably 
best you can beat out of it..

Of course if you are scanning a few million of them sequentially, then it is 
different story.

> This is my bigger problem: i am using EOF (OR mapping tool) which frees
> me more or less form writing a lot of SQL. If i need to typecast to use
> an index then i have to see how to do this with this framework.

Well, you can direct your queries to a function rather than table, that would 
cast the argument appropriately and select. Postgresql support function 
overloading as well, in case you need different types of arguments with same 
name.

Or you can write an instead rule on server side which will perform casting 
before touching the table.

I am not sure of exact details it would take to make it work, but it should 
work, at least in theory. That way you can preserve the efforts invested in 
the mapping tool. 

Of course, converting everything to integer might be a simpler option after 
all..:-)


 Shridhar




view thread (17+ messages)  latest in thread

Message-ID: <200401051806.27496.shridhar_daithankar@myrealbox.com>
Permalink:  ../200401051806.27496.shridhar_daithankar@myrealbox.com/
Also on:    postgresql.org/message-id/200401051806.27496.shridhar_daithankar@myrealbox.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: shridhar_daithankar@persistent.co.in
  Subject: Re: optimizing Postgres queries
  In-Reply-To: <200401051806.27496.shridhar_daithankar@myrealbox.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