• Skip to main content
  • Skip to primary sidebar

DBA Diaries

Thoughts and experiences of a DBA working with SQL Server and MySQL

GROUPING SETS performance versus UNION performance

January 2, 2012 by Andy Hayes 1 Comment

GROUPING SETS is a way of aggregating data to produce a result set containing different sets of columns. For the SQL Server platform, it was first introduced in SQL 2008. Prior to SQL Server 2008, achieving this type of result set was possible using UNION, WITH CUBE, WITH ROLLUP and a helper function called GROUPING to achieve similar results. The issues with WITH CUBE … [Read more...] about GROUPING SETS performance versus UNION performance

Database views explained

December 30, 2011 by Andy Hayes 2 Comments

database views

Database views are virtual tables which are built up using a SELECT query. The query may contain one or more tables. To help explain database views, here is a quick script created using SQL Server to create some tables and data. (If you want to create the tables using MySQL, then substitute the part "IDENTITY(1,1)" with "AUTO_INCREMENT") [sourcecode language='sql']CREATE … [Read more...] about Database views explained

How to shrink tempdb

December 27, 2011 by Andy Hayes 15 Comments

There may come a time when you might want to shrink tempdb because it has become too large. There are a few ways you can do this and I have listed them below but please read to the end of the post before making a decision on which way you want to approach this. There is an important note at the end of the post. So first, we'll look at the configuration on my … [Read more...] about How to shrink tempdb

SQL Server TempDb – what’s it for?

December 13, 2011 by Andy Hayes 3 Comments

sql server tempdb

SQL Server TempDB is a system database, automatically created when you install SQL Server. So what is it used for? Well a few things actually but first I have to tell you that Microsoft didn't name tempdb because they couldn't think of a suitable name. It is a temporary database which is re-created every time the SQL Server service is started and at a higher level, it … [Read more...] about SQL Server TempDb – what’s it for?

The importance of the foreign key constraint

December 4, 2011 by Andy Hayes 8 Comments

foreign key constraint

The foreign key constraint is an important aspect of database design. This article explains why. Foreign key constraint advantages The purpose of the foreign key constraint is to enforce referential integrity but there are also performance benefits to be had by including them in your database design. Firstly lets look at an example of how they are used in database … [Read more...] about The importance of the foreign key constraint

« Previous Page
Next Page »

Primary Sidebar

Categories

  • All Articles (84)
  • Career Development (8)
  • MySQL Administration (18)
  • MySQL Performance (2)
  • SQL Server Administration (24)
  • SQL Server News (3)
  • SQL Server Performance (14)
  • SQL Server Security (3)
  • SQL Tips and Tricks (21)

Top 10 Popular Posts

  • Using sp_change_users_login to fix SQL Server orphaned users
  • MySQL SHOW USERS? – How to List All MySQL Users and Privileges
  • How to shrink tempdb
  • How to Transfer Logins to Another SQL Server or Instance
  • How to Delete Millions of Rows using T-SQL with Reduced Impact
  • T-SQL – How to Select Top N Rows for Each Group Using ROW_NUMBER()
  • New T-SQL features in SQL Server 2012 – OFFSET and FETCH
  • How to Kill All MySQL Processes For a Specific User
  • Using exec sp_who2 to help with SQL Server troubleshooting
  • How to fix “conversion failed when converting date and/or time from character string”

Recent Posts

  • How to fix “conversion failed when converting date and/or time from character string”
  • Using SQL GROUPING SETS for Multiple GROUP BY Queries in a Single Query
  • How to Setup MySQL Master Master Replication
  • How To Use SQL to Convert a STRING to an INT
  • How to set up MySQL Replication Tutorial

Search

Connect

  • Twitter
  • Facebook
  • RSS

About

  • Cookie Policy
  • Disclaimer
  • About
Copyright ©