Subject | Re: [ib-support] Indices and low selectivity |
---|---|
Author | Martijn Tonies |
Post date | 2003-02-26T13:29:24Z |
Hi,
very poor selectivity... I wouldn't index that column.
rename the table (creating a new one, changing FKs etc) and
create a view with the same name as the table, but has a
WHERE IsDeleted = 'N' clause appended.
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."
> I have got a small table with about 5.000 records (largeThis column will only have values "N" and "Y" - resulting in
> rows) and approx. three inserts a day. 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'.
>
> I am wondering what is more expensive for the engine: to
> scan the whole table or work with an index on the IsDeleted
> column.
very poor selectivity... I wouldn't index that column.
> As I said, the table is quite small, but there are lots ofbtw, perhaps - in order to avoid changing all queries, you can
> selects on it (users, SPs, report generators).
>
> I am sure some of you have already made some experiences with
> such a scenario and I would be glad if you could share them
> with me ;-)
rename the table (creating a new one, changing FKs etc) and
create a view with the same name as the table, but has a
WHERE IsDeleted = 'N' clause appended.
With regards,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase & Firebird
Firebird Workbench - the developer tool for Firebird
Upscene Productions
http://www.upscene.com
"This is an object-oriented system.
If we change anything, the users object."