Normalization, Unions, Joins, and Locking in Microsoft SQL

What is a normalized database?

Database normalization is the process of organizing the fields and tables of a relational database to minimize redundancy. Normalization usually involves dividing large tables into smaller (and less redundant) tables and defining relationships between them.

What is a SQL union/join?

Unions combine rows. Joins combine columns. UNION combines the results of two or more queries into a single result set that includes all the rows that belong to all queries in the union. By using JOINs, you can retrieve data from two or more tables based on logical relationships between the tables. Joins indicate how SQL should use data from one table to select the rows in another table.The UNION operation is different from using JOINs that combine columns from two tables.

What is SQL locking?

Locking prevents simultaneous changes to the data in Microsoft SQL Server. Locks are managed internally by the Microsoft SQL Server Compact Database Engine.

How to open the Performance Monitor?

On a Windows computer, click Start, click in the Search box, type perfmon.msc, and then press ENTER. In the navigation tree, expand Monitoring Tools, and then click Performance Monitor.

What does the Performance Monitor do?

The “Performance Monitor” under the “Microsoft SQL Server” entry under your Start Menu is the same “Performance Monitor” under the “Administrative Tools” entry under your Start Menu. They are the same programs. What is different is that when you bring up Performance Monitor from under the “Microsoft SQL Server” entry, is that it comes up already running several pre-configured SQL Server performance counters.

Here are the key counters to watch on a regular basis:

  • Memory — Pages/Sec: To see how much paging my server is doing. This should be close to zero on a dedicated SQL Server. You will see spikes during backups and restores, but this is normal.
  • Network Interface — Bytes Total/sec: To see how much network activity is going on.
  • PhysicalDisk — % Disk Time — _Total: To see how busy all the disk drives are.
  • PhysicalDisk — Current Disk Queue Length — _Total: Also to see how busy the drives are.
  • System — % Total Processor Time: To see how busy all the CPUs are as a whole.
  • System — Processor Queue Length: Also see how busy the CPUs are.
  • SQLServer: General Statistics — User Connections: To see how many connections (and users) are using the server. Keep in mind that one connection does not equal one user. A single user can have more than one connection, and a single connection can have more than one user.
  • SQLServer: Access Methods — Page Splits/sec: Lets me know if page splits are an issue or not. If so, then that means I need either to increase the fill factor of my indexes, or to rebuild the indexes more often.
  • SQLServer: Buffer Manager — Buffer Cache Hit Ratio: To find out if I have enough memory in the server. Keep in mind that this ratio is based on the average of the buffer hit cache ratio since the SQL Server service was last restarted, and is not a reflection of the current buffer cache hit ratio.
  • SQLServer: Memory Manager — Target Server Memory (KB): To see how much memory SQL Server wants. If this is the same as the SQLServer: Memory Manager — Total Server Memory (KB) counter, then I know that SQL Server has all the memory that it wants.
  • SQLServer: Memory Manager — Total Server Memory (KB): To see how much memory SQL Server actual is using. If this is the same as SQLServer: Memory Manager — Target Server Memory (KB), then I know that SQL Server has all the memory that it wants. But if this is smaller, then SQL Server needs more available memory in order to run at its optimum performance.

Posted

in

by

Tags: