Skip site navigation (1) Skip section navigation (2)

Re: using greater than or less than vs equals in where condition

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: dbadmin(at)nqadmin(dot)com
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: using greater than or less than vs equals in where condition
Date: 2005-05-13 03:12:25
Message-ID: 19398.1115953945@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-admin
Prasanth <dbadmin(at)nqadmin(dot)com> writes:
> PG Version: 7.4.7

> explain analyze select * from data where type_code >'2' AND type_code<'4';
> [ is slow ]
> explain analyze select * from data where type_code = '3';
> [ isn't ]

Are there a whole lot of rows with type_code = 2?  If so, this is
fixed in 8.0.

2003-12-20 20:23  tgl

	* src/: backend/access/nbtree/nbtinsert.c,
	backend/access/nbtree/nbtpage.c, backend/access/nbtree/nbtsearch.c,
	include/access/nbtree.h: Improve btree's
	initial-positioning-strategy code so that we never need to step
	more than one entry after descending the search tree to arrive at
	the correct place to start the scan.  This can improve the behavior
	substantially when there are many entries equal to the chosen
	boundary value.  Per suggestion from Dmitry Tkach, 14-Jul-03.

			regards, tom lane

In response to

Responses

pgsql-admin by date

Next:From: Adam MDate: 2005-05-13 06:28:59
Subject: Cannot verify signature of win32 8.0.3 distribution.
Previous:From: PrasanthDate: 2005-05-12 22:48:10
Subject: using greater than or less than vs equals in where condition

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group