Subject | Unecessary reads when update referenced table ? |
---|---|
Author | Evelyne Girard |
Post date | 2013-10-21T19:41:56Z |
Hi, I don't understand why Firebird seems to access all dependant tables (having a FK on the table I'm updating) even if I'm not trying to update the key.
Example : My table Securite (having user profiles for my application) has a ID_Securite primary key which is referenced by numerous FKs in other tables. When I do an update on another field of Securite, fbserver seems to search all other tables (doing 3427 indexed reads ... where I thought it would do zero) :
UPDATE securite SET typeusager='A' WHERE (typeusager IS NULL) OR (typeusager='');
19702 fetches, 0 marks, 227 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 3427 index, 170 seq.
select count(*) from securite;
316 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 0 index, 150 seq.
Thanks
Evelyne
Example : My table Securite (having user profiles for my application) has a ID_Securite primary key which is referenced by numerous FKs in other tables. When I do an update on another field of Securite, fbserver seems to search all other tables (doing 3427 indexed reads ... where I thought it would do zero) :
UPDATE securite SET typeusager='A' WHERE (typeusager IS NULL) OR (typeusager='');
19702 fetches, 0 marks, 227 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 3427 index, 170 seq.
select count(*) from securite;
316 fetches, 0 marks, 0 reads, 0 writes.
0 inserts, 0 updates, 0 deletes, 0 index, 150 seq.
Thanks
Evelyne