Why don't DBMS's support ASSERTION

前端 未结 7 993
猫巷女王i
猫巷女王i 2020-12-01 09:33

So I recently learned about ASSERTION in my databases course, and my prof noted that major databases don\'t support it, even though it is in the SQL-92 standard. I tried go

7条回答
  •  庸人自扰
    2020-12-01 10:05

    My 2 pennies:

    • Concurrency: If you take the "CHECK constraint using a scalar udf with table access" solution for SQL Server, it simply isn't safe. An assertion would probably be the same in Sybase/SQL Server type engines

    Edit: what I mean is described in these links: Scalar UDFs wrapped in CHECK constraints are very slow and may fail for multirow updates and from Tony Rogerson

    • Performance: A 10k row insert would require 10k udf-style executions each with table access. Ouch. Given the ASSERTION is per row, then this is how it has to operate. If it could work for "all rows in the INSERT", then it's simpler as a trigger, no?

    • Design: There are patterns (superkey, subtype tables etc) for maintaining data integrity on related tables using simpler constraints. If you need to check some random table for data integrity I'd say you have something wrong...

提交回复
热议问题