![]() ![]() You can tell that constraint exclusion is or is not working by looking at the explain plan. How do you know that Constraint Exclusion is actually working? SELECT item_name FROM product_items WHERE item_name = 'Kettle' will be excluded by the above constraint. ![]() Will not be excluded by the above check constraint, however SELECT item_name FROM product_items WHERE item_name LIKE 'K%' If your WHERE condition is not written in a range like manner. ![]() Even if you have a range check constraint and your where condition should rightly be constrained, it often is not.Then your constraint may be used in constraint exclusion scenario. However if you wrote the constraint such asĪLTER TABLE product_items_j ADD CONSTRAINT chk_item_name CHECK (item_name BETWEEN 'J' AND 'JZ') The above constraint will never come into play in constraint exclusion. This means that if you add a check constraint such asĪLTER TABLE product_items_j ADD CONSTRAINT chk_item_name CHECK (item_name LIKE 'J%') Constraint_Exclusion only works for range or equality check constraints.You can also enable it on a session by session basis.Īlternatively if you don't want it enabled for all your databases but don't want to always have to toggle it on, you can enable it per database with a commandĪLTER DATABASE somedb SET constraint_exclusion=on You need to either change your nf to constraint_exclusion = on. How many ways can constraint exclusion fail - let us count the ways ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |