background preloader

DB Design

Facebook Twitter

Sql - COUNT(*) vs. COUNT(1) vs. COUNT(pk): which is better? What's the difference between a temp table and table variable in SQL Server? SQL Server 2014 In Memory OLTP: Memory-Optimized Table Types and Table Variables - SQL Server Team Blog. SQL Server 2014 In-Memory OLTP introduces two new widely advertised kinds of database objects: memory-optimized tables for efficient data access, and natively compiled stored procedures for efficient query processing and business logic execution.

SQL Server 2014 In Memory OLTP: Memory-Optimized Table Types and Table Variables - SQL Server Team Blog

However, there is a third kind of object introduced by In-Memory OLTP: the memory-optimized table type. Execution Plan Basics. We are very pleased to be allowed to publish the first chapter from Grant Fritchey's excellent new book, Dissecting SQL Server Execution Plans.

Execution Plan Basics

You can download it for free here. Grant's book is also currently available in several eBook formats:PDF format from Lulu.comMobipocket formatKindle format from ... and you can inspect an HTML version of the Table of contents here... We're currently arranging for hard copies of the book to be printed. We'll let you know where you can get them, as soon as they are available. Every day, out in the various discussion boards devoted to Microsoft SQL Server, the same types of questions come up again and again: Why is this query running slow?

5.7 Using Master/Slave Replication with ReplicationConnection. Divided We Stand: The SQL of Relational Division. Businesses often require reports that require more than the classic set operators.

Divided We Stand: The SQL of Relational Division

Java - How to load lazy fetched items from Hibernate/JPA in my controller. Java Persistence/ElementCollection. JPA 2.0 defines an ElementCollection mapping.

Java Persistence/ElementCollection

It is meant to handle several non-standard relationship mappings. Versioning & Optimistic Locking in Hibernate - Intertech Blog. By Jim White (Directory of Training and Instructor) A few weeks ago while teaching Hibernate, a student (thanks Dan) asked me about whether version numbers can be generated by the database.

Versioning & Optimistic Locking in Hibernate - Intertech Blog

The answer is – Yes, in some cases. I thought the question and an expanded discussion of Hibernate’s versioning property would be a good topic for this week’s blog entry. The <version> property (or @Version annotation) SQL Server Index Basics. Given the fundamental importance of indexes in databases, it always comes as a surprise how often the proper design of indexes is neglected.

SQL Server Index Basics

It often turns out that the programmer understands detail, but not the broad picture of what indexes do. Bob Sheldon comes to the rescue with a simple guide that serves either to remind or educate us all! One of the most important routes to high performance in a SQL Server database is the index. Indexes speed up the querying process by providing swift access to rows in the data tables, similarly to the way a book’s index helps you find information quickly within that book. In this article, I provide an overview of SQL Server indexes and explain how they’re defined within a database and how they can make the querying process faster.

Index Structures. Converting a delimited string of values into columns. I have seen a few questions asking how to transform a delimited values into columns, so I thought I would talk about it here.

Converting a delimited string of values into columns

In most cases it is recommended to use a string parser function to split the string; however, today I want to talk about another method. This method takes advantage of the XML data type that was introduced in SQL Server 2005. What is nice about the XML data type is it preserves the document order. Visual Representation of SQL Joins. Introduction This is just a simple article visually explaining SQL JOINs.

Visual Representation of SQL Joins

Background I'm a pretty visual person. Things seem to make more sense as a picture. I looked all over the Internet for a good graphical representation of SQL JOINs, but I couldn't find any to my liking. Using the code I am going to discuss seven different ways you can return data from two relational tables. For the sake of this article, I'll refer to 5, 6, and 7 as LEFT EXCLUDING JOIN, RIGHT EXCLUDING JOIN, and OUTER EXCLUDING JOIN, respectively.

Inner JOIN This is the simplest, most understood Join and is the most common. Hide Copy Code SELECT <select_list> FROM Table_A A INNER JOIN Table_B B ON A.Key = B.Key Left JOIN. Star schema. The star schema gets its name from the physical model's[2] resemblance to a star with a fact table at its center and the dimension tables surrounding it representing the star's points.

Star schema

Model[edit] The star schema separates business process data into facts, which hold the measurable, quantitative data about a business, and dimensions which are descriptive attributes related to fact data. Examples of fact data include sales price, sale quantity, and time, distance, speed, and weight measurements. Related dimension attribute examples include product models, product colors, product sizes, geographic locations, and salesperson names. Optimizing Data Warehouse Query Performance Through Bitmap Filtering. Most data warehouse queries are designed to follow a star schema and can process hundreds of millions of rows in a single query.

Optimizing Data Warehouse Query Performance Through Bitmap Filtering

By default, the query optimizer detects queries against star schemas and creates efficient query plans for them. One method the optimizer can use to generate an efficient plan is to use bitmap filtering.