Delete cascade postgres9/1/2023 ![]() ![]() Trigger RI_ConstraintTrigger_a_24909 for constraint fk_item on item: time=0.318 calls=1 Trigger RI_ConstraintTrigger_a_24886 for constraint fk_item on item: time=0.269 calls=1 Trigger RI_ConstraintTrigger_a_24863 for constraint fk_item on item: time=0.278 calls=1 Trigger RI_ConstraintTrigger_a_24840 for constraint fk_item on item: time=0.333 calls=1 Trigger RI_ConstraintTrigger_a_24817 for constraint fk_item on item: time=0.351 calls=1 Trigger RI_ConstraintTrigger_a_24784 for constraint fk_item on item: time=50.434 calls=1 ![]() ![]() Trigger RI_ConstraintTrigger_a_24747 for constraint fk_item on item: time=33.225 calls=1 Trigger RI_ConstraintTrigger_a_24719 for constraint fk_item on item: time=0.232 calls=1 Trigger RI_ConstraintTrigger_a_24686 for constraint fk_item on item: time=0.116 calls=1 It meant that there would be a kind of n^2 search because of that loop (delete item => delete p1 and meta_p1 but delete meta_p1 also means delete p1), as shown on the EXPLAIN ANALYZE VERBOSE results: Delete on em (cost=0.42.8.44 rows=1 width=6) (actual time=0.100.0.100 rows=0 loops=1) Same when deleting a meta_p1: all p1 "contained" in the meta part were supposed to be deleted (which is a logic flaw, as an instance of p1 can also exist outside of meta_p1). Whenever an item is deleted, I want all parts p1, p2. (I might have reversed (1) and (n), I mean " (1) item has (n) meta_p1"). Which means we have a graph like this (mind the ASCII-art )) DEVICE ITEM
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |