Subject | Re: [firebird-support] Triggers and referential integrity |
---|---|
Author | Martijn Tonies |
Post date | 2003-10-21T08:39:30Z |
Hi Tim,
quite some improvements for Firebird 1.5 - so that really might help. A lot.
Nevertheless, I would certainly sacrifice a bit of performance for RI.
Mind you - this depends heavily on the type of queries you're running -
so you should always test on a filled database.
Also, if these are simple lookup tables, with only a few values - consider
using a DOMAIN with a check constraint:
Example, in The Netherlands we can use the following VAT types:
zero (0%), high (19%), low (6%). Of course, I could create a look up
table:
VAT_TYPES
TYPE, DESCRIPTION, PERCENT
ZE, Zero, 0
HI, High, 19
LO, Low, 6
Or use a domain to avoid a lookup:
VAT
Integer, value in (0, 6, 19) or value is NULL
Of course, when the vat percentage changes, you need to do some
additional work - but at least it avoids the low-index-selectivity thingy.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com
> Well the problem is that I have a few (5 or 6) small tables with fewThat depends on the query plan the optimizer is using. The optimizer had
> values. From what I understand from Helen, this means that the index
> selectivity is low, and hence that there will be a substantial performance
> degradation.
quite some improvements for Firebird 1.5 - so that really might help. A lot.
Nevertheless, I would certainly sacrifice a bit of performance for RI.
Mind you - this depends heavily on the type of queries you're running -
so you should always test on a filled database.
Also, if these are simple lookup tables, with only a few values - consider
using a DOMAIN with a check constraint:
Example, in The Netherlands we can use the following VAT types:
zero (0%), high (19%), low (6%). Of course, I could create a look up
table:
VAT_TYPES
TYPE, DESCRIPTION, PERCENT
ZE, Zero, 0
HI, High, 19
LO, Low, 6
Or use a domain to avoid a lookup:
VAT
Integer, value in (0, 6, 19) or value is NULL
Of course, when the vat percentage changes, you need to do some
additional work - but at least it avoids the low-index-selectivity thingy.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com