Subject Re: [firebird-support] Re: Poor selectivity in foreign keys
Author German Pablo Gentile
>You may still want to have indexes on those LOG_OWNER columns in the child
>tables. Do this (I'm guessing about the names of the primary keys in the
>child tables):
>
>CREATE INDEX FK_LOG_TOTALS_ANAGR
> ON LOG_TOTALS(LOG_OWNER, PK_LOG_TOTALS);
>CREATE INDEX FK_REGION_TOTALS_ANAGR
> ON REGION_TOTALS(LOG_OWNER, PK_REGION_TOTALS);
>CREATE INDEX FK_PROVINCE_TOTALS_ANAGR
> ON REGION_TOTALS(LOG_OWNER, PK_PROVINCE_TOTALS);
>CREATE INDEX FK_QSO_ANAGR
> ON REGION_TOTALS(LOG_OWNER, PK_QSO);
>
>This makes the indexing for the trigger searches highly selective. Run
>some typical volumes of test data both with and without the indexes, to
>test whether the indexing is actually useful for performance.
>
>Apologies for any copy-paste errors - take this code as "indicative". :-)
>
>
>

That striggers are very usefull for me, finally you show me the way!

:)

I still dont understand wich is the idea in creating that foreign keys
if i dont use internal RI (i use that in triggers, i mind).
please can you show me how to write a trigger avoiding delete a record
in ANAGRAPHICS if tehere anyc child record in teh others tables?

TIA.

German.