|
data base unlimited data base unlimited |
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
Home Up Autonumbering SQL Problems Correlation Temp tables Semi-dynamic UK Post Codes SQL7 SP2
|
DenormalisationOptimising correlations through denormalisationNow we can improve the efficiency of our searches substantially. We add two columns to the main "JOBS" table: statusdate (datetime or smalldatetime) Now every time we make a change to status, we run a stored procedure which inserts a new row in the JOBSTATUS table and simultaneously updates the JOBS table. Remember to keep the two phases (insert new row, update JOBS table) inside a transaction. create proc NewStatus Then run the query select and we get the same result as before:
Problem resolvedThis time we have cut down the I/O to the number of results + 1 (because we are using a non-clustered index). We have an additional I/O on insert however. Table: jobs scan count 1, logical reads: 9 Insert/update: 1 or 2 additional I/O Total I/O: 11, down from 109 +. Consider denormalisation when frequent searches would give expensive correlations or joins Copyright DBU 2000.
|
Location Map
Updates
|
||||||||||||||||||||||||||||||||||||