Subject Re: [ib-support] Indices and low selectivity
Author Phil Shrimpton
On Wednesday 26 February 2003 13:21, you wrote:

Hi,

> Sometimes records
> from this table have to be deleted and my customer wants
> that these are not physically deleted, but only marked
> as 'deleted'.
>
> Of course this means that the where clause of many queries
> have to be modified:
> SELECT x FROM Y WHERE IsDeleted = 'N'.

Creating a view that only 'shows' non-deleted records would be easier than
updating all you queries. It would be even easier if you could rename the
table, and create the view with the same name as the 'origional' table, then
you would not have to change any queries.

> I am wondering what is more expensive for the engine: to
> scan the whole table or work with an index on the IsDeleted
> column.

Don't index 'boolean' fields

Phil
--
Linux 2.4.4-4GB
11:36am up 43 days, 17:26, 1 user, load average: 0.12, 0.04, 0.01