Subject What is best approach for performance ???
Author m24paul
Hi
I create custom component for using in my application, instead of
default combobox. This component have `All' property for all record
in that combobox.
I need to know which sql have better performance on large tables:
a. select ProductId, ProductName from Products where ProductId
like :ComboBoxSelectedValue;
In this case in combobox value for `All' record is `%' and is passed
to query.
b. select ProductId, ProductName from Products where (-1=
ProductId) or (ProductId=:ComboBoxSelectedValue=;
In this case in combobox value for `All' record is `-1' and is passed
to query.

I don't see differences on my development database. I have ~12000
products. I intend to use this components for other fields, like
orders or payments, where I could have ~ 1-2 mil records in 1 year!

Thanks,
Paul