How can the key and foreign key constraints be enforced by the DBMS? Is the enforcement technique you suggest difficult to implement? Can the constraint checks be executed in an efficient manner when updates are applied to the database?

What will be an ideal response?


One possible technique that is often used to check efficiently for the key constraint is to create an index on the combination of attributes that form each key (primary or secondary). Before inserting a new record (tuple), each index is searched to check that no value currently exists in the index that matches the key value in the new record. If this is the case, the record is inserted successfully. For checking the foreign key constraint, an index on the primary key of each referenced relation will make this check relatively efficient. Whenever a new record is inserted in a referencing relation, its foreign key value is used to search the index for the primary key of the referenced relation, and if the referenced record exists, then the new record can be successfully inserted in the referencing relation. For deletion of a referenced record, it is useful to have an index on the foreign key of each referencing relation so as to be able to determine efficiently whether any records reference the record being deleted. If the indexes described above do not exist, and no alternative access structure (for example, hashing) is used in their place, then it is necessary to do linear searches to check for any of the above constraints, making the checks quite inefficient.

Computer Science & Information Technology

You might also like to view...

Rewrite the for loop body from the SnakeEyes program so that the variables num1 and num2 are not used

What will be an ideal response?

Computer Science & Information Technology

The Quick Launch, the menu on the bottom of your screen, gives access to different areas of the document library

Indicate whether the statement is true or false

Computer Science & Information Technology

When a subform is created in a main form, a separate form object is created and displays in the Navigation Pane under Forms

Indicate whether the statement is true or false

Computer Science & Information Technology

If the path and filename are left off the URL, the browser searches for a file named ____ in the root folder of the Web server.

a. index.htm b. index.html c. index.http d. Either A or B

Computer Science & Information Technology