jkakar ([info]jkakar) wrote,
@ 2008-01-13 18:09:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Entry tags:postgres database

Analysis is hard
After even further analysis, it turns out that using or not using ON
DELETE CASCADE isn't the thing that really affects the time it takes
to delete the data. The speed-up is gained by using 3 separate
statements to delete rows from child tables first followed by the
parent table. The same speed-up is present when ON DELETE CASCADE
rules are present.




(2 comments) - (Post a new comment)


[info]radix.twistedmatrix.com
2008-01-14 07:52 pm UTC (link)
On the other hand, that still indicates that the *effect* of ON DELETE CASCADE is slowing you down, doesn't it? Really, deleting directly from the parent row *can* be as fast as explicitly deleting the dependent rows first, if the database is smart enough. Doing it explicitly is still doing the same thing, which is avoiding the effect of ON DELETE CASCADE.

(Reply to this) (Thread)


[info]jkakar
2008-01-14 09:30 pm UTC (link)
Yes, that's true. I think ON DELETE CASCADE is implemented as a
trigger which results in this sub-optimal behaviour. I wonder how
other non-PostgreSQL databases cope.

(Reply to this) (Parent)


(2 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…