Articles tagged SQL

09 April 2015
09 April 2015

Schema-Based Access Control for SQL Server Databases

Access-control within the database is important for the security of data, but it should be simple to implement. It is easy to become overwhelmed by the jargon of principals, securables, owners, schemas, roles, users and permissions, but beneath the apparent complexity, there is a schema-based system that, in combination with database roles and ownership-chaining, provides a relatively simple working solution.… Read more
01 April 2015
01 April 2015

How DBAs Can Adopt the Craftsman Mindset

The job of a DBA requires a fusion of skill and knowledge. To acquire this requires a craftsman mindset. Craftsmen find that the better they get at the work, the more enjoyable the work gets, and the more successful they become. Deliberate practice, Specialization and an appetite for overcoming difficulty are good habits to deliberately adopt to successfully grow those craftsmanlike skills to the point that you become "so good they can't ignore you".… Read more
18 March 2015
18 March 2015

Premature Scalability and the Root of All Evil

When you're designing an application, there is a temptation to build it to a super-scalable future-proof architecture, even when the immediate requirements can be met by a simple single-tier application that can exploit the pure power of IIS and SQL Server. Dino recounts the painful story of what happened when the gurus got their way.… Read more
18 March 2015
18 March 2015

Never Ignore a Sort Warning in SQL Server

It is always bad news if your SQL queries are having to use the SORT operator. It is worse news if you get a warning that sort operations are spilling onto TempDB. If you have a busy, slow TempDB, then the effect on performance can be awful. You should check your query plans to try to eliminate SORTs and never leave a SORT warning unheeded. Fabiano Amorim shows the range of ways of getting information on what is going on with a query that is doing a SORT and when requests are made for memory.… Read more
18 March 2015
18 March 2015

SQL Server Spatial Indexes

Spatial Data in SQL Server has special indexing because it has to perform specialised functions. It is able, for example, to break down an indexed space into a grid hierarchy by using a technique called tessellation. This is a rules-based system that, when you compare a shape to an index, works out how many cells in the the grid hierarchy are touched by that shape , and how deep down the grid hierarchy to search. There is powerful magic in Spatial Indexes as Surenda and Roy explain.… Read more
10 March 2015
10 March 2015

Identifying and Solving Index Scan Problems

When you're developing database applications, it pays to check for index scans in the SQL Server query plan cache. Once you've identified the queries, what next? Dennes Torres gives some preliminary guidelines on how to find out why these index scans are being chosen for these queries and how to make the queries run faster and more efficiently.… Read more
10 March 2015
10 March 2015

Self-maintaining, Contiguous Effective Dates in Temporal Tables

'Temporal' tables contain facts that are valid for a period of time. When they are used for financial information they have to be very well constrained to prevent errors getting in and causing incorrect reporting. This makes them more difficult to maintain. Is it possible to have both the stringent constraints and simple CRUD operations? Well, yes. Dwain Camps patiently explains the whole process.… Read more
27 February 2015
27 February 2015

Defusing Database Time Bombs: Avoiding the Need to Refactor Databases

Where applications are evolved by gradually molding them to a growing understanding of the business domain, this presents great challenges to database development. If databases are designed too loosely, and initial errors are allowed to fester, the results become harder and harder to refactor until eventually they constitute a database time bomb. Thomas LeBlanc describes how to avoid a few basic, but very common, database time bombs. … Read more
11 February 2015
11 February 2015

Questions About SQL Server Transaction Log You Were Too Shy To Ask

You can give a deep-dive presentation about SQL Server's transaction log, and round it off by inviting questions. Your audience will stare awkwardly at their boots. Afterwards, to your surprise there will be a queue of questioners, and the questions are the ones they were too shy to ask out loud. Tony Davis answers these apparently simple, yet tricky questions.… Read more
11 February 2015
11 February 2015

The DRI Subject of References

A database must be able to maintain and enforce the business rules and relationships in data in order to maintain the data model. It does this through referential constraints. They aren't complex, but are powerful, especially with the means to attach DRI actions to them. Joe Celko explains all, and pines for the ANSI CREATE ASSERTION statement… Read more
11 February 2015
11 February 2015

Checking the Plan Cache Warnings for a SQL Server Database

How often do you check your query plans during development to see if they contain any warnings? If you're missing them, it means that you're not getting all those hints about missing indexes, join predicates or statistics. Is the query optimiser trying to tell you about implicit conversions? Dennes shows how to view the warnings in plan cache for a particular database using SQL… Read more
04 February 2015
04 February 2015

The Promise – and the Pitfalls – of In-Memory OLTP

When SQL Server 2014 was released, it included Hekaton, Microsoft's much talked about memory-optimized engine that brings In-Memory OLTP into play. With memory-optimized tables 30 times faster than disk-based tables, higher performance is promised - but at what cost? Jonathan Watts looks at the features that have improved, and those that need careful consideration.… Read more
04 February 2015
04 February 2015

The Importance of Caching

Performance tuning and optimization definitely have their place in minimizing SQL Server Licensing costs - by helping keep CPU utilization low. But it's important to remember that the fastest and most efficient query possible is the one that you never execute against your SQL Server. That might sound trite, but it's at the heart of caching - which is key to helping organizations save significant money on SQL Server licensing costs while simultaneously enabling better application performance and increased scalability. … Read more
03 February 2015
03 February 2015

Managing Test Data as a Database CI Component – Part 1

Constructing a test environment for your databases can be a difficult task at the best of times. Once you've actually acquired the hardware needed and architected the environment, you still have to arrange and securely transport the data. And with the rising demand for fast feedback and continuously integrated processes, having all of this automated and operating at speed is a challenge all of its own.… Read more
26 January 2015
26 January 2015

Bowled Over by SQL Window Functions

What better way to learn how to construct complex CHECK CONSTRAINTs, use the SQL 2012 window frame capability of the OVER clause and LEAD analytic function, as well as how to pivot rows into columns using a crosstab query? Create the SQL code to score Ten-pin Bowling, of course. Dwain Camps explains the how, what and why.… Read more