Re: [SQL] Curious problem of using BETWEEN with start and end being the same versus EQUALS '='

2013-01-15 Thread Venky Kandaswamy
: Venky Kandaswamy Cc: pgsql-gene...@postgresql.org; pgsql-sql@postgresql.org Subject: Re: [SQL] Curious problem of using BETWEEN with start and end being the same versus EQUALS '=' Venky Kandaswamy writes: >On 9.1, I am running into a curious issue. It's not very curious a

Re: [SQL] Curious problem of using BETWEEN with start and end being the same versus EQUALS '='

2013-01-15 Thread Tom Lane
Venky Kandaswamy writes: >On 9.1, I am running into a curious issue. It's not very curious at all, or at least people on pgsql-performance (the right list for this sort of question) would have figured it out quickly. You're getting a crummy plan because of a crummy row estimate. When you do

[SQL] Curious problem of using BETWEEN with start and end being the same versus EQUALS '='

2013-01-15 Thread Venky Kandaswamy
All, On 9.1, I am running into a curious issue. I will explain the issue in high level terms using psuedo SQL statements. Consider a SQL statement: SELECT a, b, c FROM tab WHERE a = value1; - This does an index scan followed by a merge join and takes about 37 secs to execute If I change the