Print
Category: IT
Hits: 628

Normalization

 

First Normal Form : No repeating content between any two rows. Separate table for repeats

Second Normal Form : No repeating content for part of composite key. Separate key+table

Third Normal Form : A non-key field cannot depend on another non-key field. Make field key

 

Pros:

 

Cons:

 

Managing denormalized data

 

Whatever denormalization techniques you use, you need to ensure data integrity by using:

From an integrity point of view, triggers provide the best solution,

 

Indexes

 

Clustered Index

 

 

Composite Index

 

 

Update Statistics

 

Locks(sp_lock)

 

ALLPAGES

 

DATAPAGES

 

DATAROWS

 

Page and Row Locks

 

Shared Lockno exclusive lock can be held

Exclusive Lockno other lock of any kind

Update Lockshared lock OK, to be promoted to Exclusive Lock

 

Table Locks

 

Intent Locklock is currently held

 

Isolation Level(set transaction isolation level 3)

 

The transaction is allowed to read uncommitted changes to data. Select operation does not lock table.

The transaction is allowed to read only committed changes to data. Select operation locks table.

The transaction can repeat the same query, and no rows that have been read by the transaction will have been updated or deleted. New rows can appear however.

The transaction can repeat the same query, and receive exactly the same results. No rows can be inserted that would appear in the result set.

 

Cursor

 

 

Misc

 

@@sqlstatus = 1 Error

                      = 2 End of result set

 

 

Transaction ACID

 

Atomicity- atomic transaction – all or nothing

Consistency- database consistent at all time regardless of success or failure

Isolation- no changes visible to other processes until transaction is committed

Durability- committed transactions should survive all kinds of crashes

 

CRUD Interface

 

Create

Retrieve

Update

Delete

 

The case against MySQL