Articles tagged SQL

02 November 2015
02 November 2015

SQL Server Heaps, and Their Fragmentation

In SQL Server, heaps are rightly treated with suspicion. Although there are rare cases where they perform well, they are likely to be the cause of poor performance. If a table is likely to have a large number of changes, then it can become fragmented due to way that space is allocated and forward pointers used. How does one detect this problem? Is it significant? How does one deal with it, if necessary?… Read more
02 November 2015
02 November 2015

Implementing Continuous Integration for Databases

Continuous integration (CI) is becoming more and more common in application development. It ensures code and related resources are integrated regularly and tested by an automated build system, and highlights problems early in the development process. But what about database development? Can the same advantages of CI be applied to production databases? Where do you start? How do you tackle it? Sjors Takes relates his experience.… Read more
21 October 2015
21 October 2015

Automating Your SQL Server Best Practice Reports: The Document

If you're making a report from table-based data, an MS Word document is often a good option. In the second part of his introduction to SQL Server best-practice monitoring, Laerte Junior shows how to use PowerShell scripts to create a Word-based report with colour-coded alerts where there are problems or best practices aren't being followed.… Read more
15 October 2015
15 October 2015

Top 10 Most Common Database Scripts

What are the scripts that a working DBA uses so often that they become part of the 'muscle memory'? Grant Fritchey asked the question on the forums of SQL Server Central. From the large response, Grant was able to pick out the ten most popular T-SQL commands, scripts, or fragments. It seems as if, despite the range of tasks we do, there are some common tools we use.… Read more
06 October 2015
06 October 2015

Automating Your SQL Server Best Practice Reports:The Checks

A DBA in charge of a whole lot of databases and servers has to check regularly that there are no likelihood of problems. The task is well suited for automation as workload increases. Laerte Junior introduces a PowerShell-based reporting framework that aims to simply provide a Word-based report with colour-coded alerts where there are problems or best practices aren't being followed.… Read more
30 September 2015
30 September 2015

Introducing SQL Server In-Memory OLTP

In-Memory OLTP, aka Hekaton, originally shipped with 2014, and although it certainly helped the performance of certain types of workload, it then had certain restrictions that impeded its widespread adoption.With SQL Server 2016, there is more support for In-Memory OLTP and a more seamless integration with SQL Server's Database Engine. It is time to consider whether In-Memory OLTP can help those pinch-points in your data throughput, explains Artemakis Artemiou.… Read more
25 September 2015
25 September 2015

SQLXML Bulk Loader: The Sequel

0
8
SQLXML isn't exactly new technology, and parts of it aren't pretty, but if you need to heave vast quantities of XML data into a SQL Server database then you may come to appreciate the raw speed of which it's capable. Adam Aspin shows how to configure the SQL XML Bulk Loader tool for optimal data loading performance.… Read more
24 September 2015
24 September 2015

Dependencies and References in SQL Server

It is important for developers and DBAs to be able to determine the interdependencies of any database object. Perhaps you need to work out what process is accessing that view you want to alter, or maybe find out whether that table-type you wish to change is being used. What are all these dependencies? How do you work out which are relevant? Phil Factor explains.… Read more
21 September 2015
21 September 2015

Power Query Formula Language in Power BI Desktop

0
73
The Power Query Formula Language (PQFL) is a functional language that drives the Power BI transformations, and allows you to create mashup queries from scratch. Rob demonstrates how to use it in Power BI Desktop to extract data from its source, filter rows, specify the columns, clean the data, and create visualisations.… Read more
18 September 2015
18 September 2015

SQL and R

0
44
Not only can you easily retrieve data from SQL Sources for analysis and visualisation in R, but you can also use SQL to create, clean, filter, query and otherwise manipulate datasets within R, using a wide choice of relational databases. There is no reason to abandon your hard-earned SQL skills!… Read more
17 September 2015
17 September 2015

Introduction to Analytic Functions (Part 2)

0
13
In the first part of this series I introduced you to the analytic functions family, outlined its close relationship to aggregate functions, and illustrated my points with a few examples. I demonstrated how, by clever use of the analytic function clauses – partition by, order by, and the windowing clause – you could tune your functions to wring even mor… Read more
09 September 2015
09 September 2015

Writing Build vNext tasks for Visual Studio Online

Hosted TFS, now called Visual Studio Online (VSO), has a new way of writing build processes called Build vNext. Agent tasks are the building blocks of processes and you can supplement the built-in ones with custom build tasks defined in JSON that use targets written in node.js or PowerShell. Jason Crease shows how to develop custom build tasks for building, testing, publishing and synchronizing databases.… Read more
09 September 2015
09 September 2015

Stumbling Towards Database Change Management

The scale of change in the insurance and financial markets is such that there is little time for the application or database developer to sit back and work out ways of improving the delivery process. Over time, however, it is possible to improve the process so that individual heroics are required less and less as release and deployment become more managed and predictable. It can be messy and error-prone at times but the long-term benefits make the struggle worthwhile.… Read more
09 September 2015
09 September 2015

How Forwarded Records are Read and Processed in a SQL Server Heap

Before you deliberately use a heap in SQL Server rather than a table, it is worth understanding why a heap has such different characteristics, and therefore relative benefits and disadvantages. Forward pointers and the Page Free Space page are designed with performance in mind, but only in certain circumstances. Uwe explains why, and how heaps can be used to advantage.… Read more
09 September 2015
09 September 2015

How to Confuse the SQL Server Query Optimizer

Gail Shaw examines three common forms of generic SQL that can and will confuse the SQL Server Optimizer to the point that it generates and reuses very inefficient execution plans. Want to 'trick' SQL Server into performing millions of logical reads to return the data, when only are few thousand were really required? Try writing catch-all queries, or using control flow statements to create general-purpose procedures, or switching parameter values within a procedure. Just don't expect the resulting queries and procedures to perform well, or consistently. The ideal solution to the problem of generic T-SQL is not to write it, but failing that Gail demonstrates techniques such as recompiling the query on each execution, using hints, dynamic SQL, or splitting generic procedures into sub-procedures.… Read more
07 September 2015
07 September 2015

How to Avoid Conditional JOINs in T-SQL

Relational databases go out of their way to execute SQL, however bad the crimes against Codd and relational theory within the query. The 'conditional join', can be executed but at great cost. As always, it is much better to sit back and restate the problem in a set-based way. The results can be rewarding.… Read more
24 August 2015
24 August 2015

Working with SQL Server data in Power BI Desktop

0
66
What's the best way of providing self-service business intelligence (BI) to data that is held in on-premise SQL Server? Not, it seems, Power BI 2.0 the hosted cloud service, but Power BI 2.0 Desktop. If moving your database to Azure isn't an option, Power BI 2.0 desktop could still bring smiles to the faces of your BI hotshots.… Read more
14 August 2015
14 August 2015

Basic SQL Server Performance Troubleshooting For Developers

The speed of a slow SQL Query can almost always be improved. In SQL Server, the query optimizer determines the best way of executing the query, based on the evidence it has. The same query can be executed in many different ways as the data size increases, new indexes become available, or as the data distribution changes. If the appropriate index doesn't exist or can't be used, then SQL Server shrugs and does the best it can. Tony Davis explains how to find out what a query needs to perform w… Read more