Search Results for: primary key constraint

Jobs That Beat The Caring Out Of You

I was inspired by Jen McCown's story here. Read that first. It's WAY better than mine. This is not an April Fools post. Fools are involved, but none were harmed. Oprah-Level SA YOU GET SA! AND YOU GET SA! I'm working for a DOTCOM startup as a developer. I have SA privs. I have SA privs because EVERYONE has SA privs. We're developing a system (this was a long time ago) in SQL Server 6.5. The database originally was designed in Paradox (where I started my career). To be as kind as possible, the database design was a living nightmare, like the worst possible black, ichorous, Lovecraftian, tentacled monstrosity to walk the earth database. It was bad. On top of that, the code we were writing was always barely functional.…
Read More

Does Query Store Pre-Allocate Space

I love the questions I get while I'm presenting because they force me to think and learn. The question in the title is one I received recently. The answer, now that I'm not standing in front of people, is easy. Of course the space is not pre-allocated. Query Store tables are just system tables. They have a limit on how big they can grow (100mb by default), but that space isn't going to be pre-allocated in any way. The space will just get used as and when it's needed, just like any other system table. However, don't take my word for it, let's prove that. The Test Testing whether or not enabling Query Store is straight forward. Here's a query that should give us information rather quickly: CREATE DATABASE QSTest; GO USE…
Read More

Query Optimizer and Data Definition Language Queries

Data Definition Language queries don't go through the optimizer, right? While normally, my short answer to this question in the past would have been, yes. However, with testing comes knowledge and I want to be sure about the statement. I'm working with a team of people to completely rewrite the SQL Server Execution Plans book. We'll probably be published in April or May. It's going to be amazing. The structure will be completely different and the book will represent five years of additional knowledge in how execution plans work and how to read and interpret them since the last book was written. However, enough on that. Let's answer the question about Data Definition Language. First of all, we need to quickly define our terms. Data Definition Language (DDL) represents the syntax for queries that build…
Read More

The Utility of Execution Plans in Natively Compiled Procedures

I'm actually having problems identifying the utility of execution plans when working with natively compiled procedures. Or, put another way, why bother? I've posted a couple of times on natively compiled procedures and SQL Server execution plans. I've found the differences interesting and enlightening, but I'm seriously questioning why I should bother, at least currently. I'm sure there will be many changes to the behaviors of the natively compiled procedures and their relationship with execution plans. But right now, well, let's look at an example. I have three simple tables stored in-memory. Here's the definition of one: CREATE TABLE dbo.Address ( AddressID INT IDENTITY(1, 1) NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT = 50000), AddressLine1 NVARCHAR(60) NOT NULL, AddressLine2 NVARCHAR(60) NULL, City NVARCHAR(30) COLLATE Latin1_General_100_BIN2 NOT NULL, StateProvinceID INT…
Read More

nHibernate Database, First Look

I'm getting my first look at a full-fledged nHibernate database developed by consultants for our company. I thought I'd share my initial impressions. I'll be capturing trace events from the database over the next couple of weeks, so I'll be following up on the behavior of nHibernate within this database as well. The first thing I saw & thought was, "Foreign key constraints. Thank the gods." That really is good news. I was frankly concerned that they might go with the "let the code handle it" approach. There are quite a few null columns. I'm also seeing tons & tons of nvarchar(255) which must the default string size. Lots of bit fields too. They also used bigint in a lot of places too. None of this is definitively good or bad,…
Read More

Database Design Process

Buck Woody recently asked a question; how do you design a database. He outlined the process he followed and asked four questions about how each of us do our work: What process do you follow? How important are the business requirements? What tool do you use to create the design, do you need it to diagram, do you even care about diagrams? What's your biggest pain-point about designing? Funny enough, I haven't done a full on database design in over a year. My company just finished about 6 years of very hard-core engineering work, designing and building or redesigning and building, the majority of our data input and collection systems. Then, I was doing lots of design work. Now, we're either largely in maintenance mode for most of those systems, or the…
Read More