Re: Query optimizer & prepared statements

From: Chris <dmagick(at)gmail(dot)com>
To: Jack Orenstein <jack(dot)orenstein(at)hds(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query optimizer & prepared statements
Date: 2009-06-23 23:03:05
Message-ID: 4A415F29.9020009@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jack Orenstein wrote:
> If x is an integer column with an index, then
>
> select ...
> from T
> where x > 1
>
> and
>
> select ...
> from T
> where x > 1000000000
>
> could be optimized differently. So how is optimization done for a
> prepared statement containing a variable, e.g.
>
> select ...
> from T
> where x > $1

http://www.postgresql.org/docs/current/static/sql-prepare.html#AEN58703
explains this.

If your parameter is a unique key, then you won't see any difference. If
your parameter is a non-unique key, there may be differences depending
on your data/distribution etc.

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Mead 2009-06-23 23:40:21 Re: Controlling proliferation of postgres.exe processes
Previous Message raghu ram 2009-06-23 22:47:06 Re: [GENERAL] Error ::- “ 'more' is not recognized as an internal or external command, operable program or batch file. “