Quantcast
Channel: Forcepoint Community
Viewing all articles
Browse latest Browse all 2011

SQL tables

$
0
0

Hi Guys, 

Recently in customer environment, Microsoft did an analyze in Websense SQL server, looking for any table that is not following the best pratices. 
And in the final report they found some tables related to Websense structure that are not following the SQL best pratices. 

Down below We have the Microsoft's report: 

"(...) Description 
One or more tables found, with foreign key constraint defined but no supporting indexes created on the foreign key columns. 

Best Practice Guidance 
SQL Server doesnt put an index on foreign key columns by default and indexing foreign key fields in referencing tables is not required. 
Foreign key columns usage must evaluated to determine whether or not indexing this column will help up increase the current workloads performance by enhancing join performance, reducing table locking (for full table scans) while cascading updates and deletes, etc 

Importance 
Creating an index on a foreign key is often useful for the following reasons: 
Changes to PRIMARY KEY constraints are checked with FOREIGN KEY constraints in related tables. 
Foreign key columns are frequently used in join criteria thats why indexing them provides better join performance 
Better performance on maintaining the relationship on a delete of a primary/unique key. When you delete a key row, SQL Server must check to see if there are any rows which reference the row being deleted. 
If the foreign key relationship is defined with NO ACTION (on update/delete) then a referenced row CANNOT be deleted as it would leave the referencing rows “orphaned.” To find the rows efficiently an index on the foreign key column helps! 
If the foreign key relationship is defined with CASCADE (on update/delete) then when a referenced row is modified all of the referencing rows must be modified as well (either updated to reflect the new value or on cascade delete). To find the rows to modify efficiently, an index on the foreign key column helps. 

Recommended Resolution 
Check all the current Foreign Keys that are used frequently in joins and create a non-clustered index for each one of them. 
The following query can be used to retrieve all the foreign key column details and whether they are part of indexes in a database (...)" 

This issue could be fixed in a future version?

Thank you, 

Abraão Dias.


Viewing all articles
Browse latest Browse all 2011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>