Re: sql question
Posted in 1993
In <27o4ejINNdfs@emory.mathcs.emory.edu> inf_bb@hermes1.sps.mot.com (Bob Baskett) writes:
>netters,
>can someone explain why the optimizer doesnt short circuit on the following
>query:
>
> QUERY:
> ------
> select *
> from book_bill_back
> where 1=2>
>
> Estimated Cost: 370832
> Estimated # of Rows Returned: 4330952
>
> 1) book_bill_back: SEQUENTIAL SCAN
>
> Filters: 1 = 2
This is treated as WHERE <expression> = <expression>.
The optimiser assumes that an expression is likely to be variable and
hands it off to the engine.
In some ways this behaviour is reasonable, after all *you* should know
whether 1 = 2, the optimiser doesn't expect you to be daft enough to say
WHERE <constant> = <constant> !!! :-)
graeme
--
Disclaimer: The author's opinions are his own, and not necessarily
those of Pyramid Technology Ltd. or Pyramid Technology Inc.
---------------------------------------------------------------------------
-m------- Graeme Sargent Voice: +44 (0)252 373035
---mmm----- Senior Database Consultant Fax : +44 (0)252 373135
-----mmmmm--- Pyramid Technology Ltd. Telex: Tell who???
-------mmmmmmm- Farnborough, Hants GU14 7PL Email: graeme@pyra.co.uk
---------------------------------------------------------------------------
We have the technology. The tricky bit is learning how to use it.