Re: Difference in query plan when using = or > in where clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Radhika S wrote:
> I am curious as to why this occurs. Why does an = change the query plan so
> drastically?
> 
> When my query is:
> Select count(*) from View_A WHERE tradedate = '20070801';
> The query plan is as below:
> ...
> But when my query is:
> Select count(*) from View_A WHERE tradedate BETWEEN '20070801' and
> '20070901';
> The query plan is:
> ...

In short, the planner estimates that "tradedate BETWEEN '20070801' and
'20070901'" matches more rows than "tradatedate = '20070801'"

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux