<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Conor vs. SQL</title><subtitle type="html">Conor Cunningham's blog on SQL Server, data-driven applications, and pretty much whatever other random stuff he decides to post.</subtitle><id>http://blogs.msdn.com/conor_cunningham_msft/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/conor_cunningham_msft/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2009-02-04T20:51:30Z</updated><entry><title>Conor vs. FOREIGN KEY join elimination</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/11/12/conor-vs-foreign-key-join-elimination.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/11/12/conor-vs-foreign-key-join-elimination.aspx</id><published>2009-11-12T15:45:23Z</published><updated>2009-11-12T15:45:23Z</updated><content type="html">I received a question from a friend in Brazil related to foreign keys and join elimination in SQL Server.&amp;#160; Yes, SQL Server can detect that some joins are not needed to return results to the user and skip them.&amp;#160; What is this evil magic, you ask?&amp;#160; Well, let’s walk through it before we get out our torches and pitchforks… &amp;#160; What’s a Foreign Key?&amp;#160; To most users, it is something that throws errors and blocks you from inserting data where you want it.&amp;#160; However, to SQL Server,...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/11/12/conor-vs-foreign-key-join-elimination.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9921384" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. Windows 7</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/10/27/conor-vs-windows-7.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/10/27/conor-vs-windows-7.aspx</id><published>2009-10-27T13:55:49Z</published><updated>2009-10-27T13:55:49Z</updated><content type="html">(Not a SQL Server post) I have been meaning to install Windows 7, and I got around to doing it last night.&amp;#160; I usually run Windows 2003/8 Server for work, so my interest in the consumer side is perhaps not as high as some others.&amp;#160; Nevertheless, I like Windows and I wanted to try it out.&amp;#160; I did not try to upgrade from Vista x64.&amp;#160; I just bought a new hard drive and figured it was time to do a clean install – funnily, a SQL Server setup issue has prevented me from installing SQL Server...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/10/27/conor-vs-windows-7.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913492" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. UNIQUE in Index Definitions</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/10/21/conor-vs-unique-in-index-definitions.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/10/21/conor-vs-unique-in-index-definitions.aspx</id><published>2009-10-21T16:18:50Z</published><updated>2009-10-21T16:18:50Z</updated><content type="html">I gave a talk to the Austin-area PASS group last night on B-Tree indexing in SQL Server, and I received a question about whether to make clustered indexes UNIQUE or not (assuming the data is unique on the key columns).&amp;#160; The expectation was that this should perform better when the index was UNIQUE. Let’s back up a minute and see things from the perspective of the Query Processor.&amp;#160; Someone comes in and creates an index on col1 of table1.&amp;#160; They don’t make it UNIQUE but they put data in...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/10/21/conor-vs-unique-in-index-definitions.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9910695" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author><category term="SQL" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/SQL/default.aspx" /><category term="performance" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/performance/default.aspx" /></entry><entry><title>Conor vs. Statement Offsets</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/conor-vs-statement-offsets.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/conor-vs-statement-offsets.aspx</id><published>2009-08-13T17:15:25Z</published><updated>2009-08-13T17:15:25Z</updated><content type="html">As most of you have figured out by now, I work mostly on queries :).&amp;#160; One of the things that I often need to do is to get a statement out of a batch so that I can go look more closely at a query plan (and, in my case, the code that generates it).&amp;#160; &amp;#160; I use the a query like this to read through a few DMVs and emit the text for the plan I want: select statement_start_offset, statement_end_offset, statement_text from ( SELECT SUBSTRING (st.text, (qs.statement_start_offset/2)+1, (( CASE...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/conor-vs-statement-offsets.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9868299" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Server Cursors</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/server-cursors.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/server-cursors.aspx</id><published>2009-08-13T16:58:40Z</published><updated>2009-08-13T16:58:40Z</updated><content type="html">My coworker Marc posted up a good introduction into the different server cursor models and you can see it here: http://blogs.msdn.com/sqlqueryprocessing/archive/2009/08/12/understanding-sql-server-fast-forward-server-cursors.aspx...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/server-cursors.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9868279" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. Stats NORECOMPUTE</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/conor-vs-stats-norecompute.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/conor-vs-stats-norecompute.aspx</id><published>2009-08-13T16:52:54Z</published><updated>2009-08-13T16:52:54Z</updated><content type="html">It’s been a busy summer.&amp;#160; I got back from vacation and have been hard at work on new features for a future version of SQL Server.&amp;#160; You can always still send me questions about the existing product, of course, and I will answer them here (conorc (at) microsoft (dot) com). &amp;#160; Today is a question that one of the MVPs asked – How do I find out if a statistics object was created with the “don’t recompute” flag?&amp;#160; Initially, I tried dbcc show_statistics, but it isn’t stored within the...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/08/13/conor-vs-stats-norecompute.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9868273" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. Dynamic SQL vs. Procedures vs. Plan Quality for Parameterized Queries</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/06/03/conor-vs-dynamic-sql-vs-procedures-vs-plan-quality-for-parameterized-queries.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/06/03/conor-vs-dynamic-sql-vs-procedures-vs-plan-quality-for-parameterized-queries.aspx</id><published>2009-06-04T01:39:02Z</published><updated>2009-06-04T01:39:02Z</updated><content type="html">I received a question from a customer today about query plan choice for a parameterized query - specifically that different plans get picked based on where the plan is located, and sometimes one might be better than another.&amp;#160; Apparently, for their application, a particular query plan was “better” when compiled in dynamic sql instead of a stored procedure.&amp;#160; Others say that query plans are just as fine when compiled within a stored procedure.&amp;#160; Which is it? (If I were still consulting,...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/06/03/conor-vs-dynamic-sql-vs-procedures-vs-plan-quality-for-parameterized-queries.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9693845" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. Recompiles, part 2</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/05/25/conor-vs-recompiles-part-2.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/05/25/conor-vs-recompiles-part-2.aspx</id><published>2009-05-25T21:39:25Z</published><updated>2009-05-25T21:39:25Z</updated><content type="html">Thanks to those of you who replied to my previous post.&amp;#160; I spent the last week or so talking with customers, coworkers, and looking at various applications to see how recompiles are modeled today in their applications.&amp;#160; At a high level, SQL Server doesn’t really “require” you to recompile at all.&amp;#160; The main set of people who seemed to think about this were people having trouble with plan selection.&amp;#160; For example, if statistics were not updated frequently enough and users were querying...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/05/25/conor-vs-recompiles-part-2.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9640736" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author><category term="recompiles" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/recompiles/default.aspx" /><category term="plan choice" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/plan+choice/default.aspx" /></entry><entry><title>Conor vs. Recompiles</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/05/18/conor-vs-recompiles.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/05/18/conor-vs-recompiles.aspx</id><published>2009-05-18T21:45:03Z</published><updated>2009-05-18T21:45:03Z</updated><content type="html">I have a question for you guys about how do you force a recompile for a single query today? &amp;#160; There are a lots of different ways that one could cause the system to recompile a query: a) sp_recompile &amp;lt;object used in a query&amp;gt; b)DBCC FREEPROCCACHE (with optional arguments to restrict the set of impacted queries) c) detach/attach db (2008+), restart server, etc. d) use a lot of memory to force plans out of memory e) update statistics f) change the text of the query (add a space), which works...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/05/18/conor-vs-recompiles.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9625720" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Do Filtered Statistics update as frequently as normal statistics?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/04/17/do-filtered-statistics-update-as-frequently-as-normal-statistics.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/04/17/do-filtered-statistics-update-as-frequently-as-normal-statistics.aspx</id><published>2009-04-18T07:01:40Z</published><updated>2009-04-18T07:01:40Z</updated><content type="html">I received a question this week about whether filtered statistics update as frequently as regular statistics.&amp;#160; The right way to ask the question is “Do filtered statistics become invalid as frequently as regular statistics?”, as stats are recomputed based on the queries that consume them, while stats are invalidated based on changes to the underlying data. The basic mechanism for stats invalidation is a per-column counter in the storage engine.&amp;#160; It’s not transacted, and it is incremented...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/04/17/do-filtered-statistics-update-as-frequently-as-normal-statistics.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9554834" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>SQL Server 2008 Internals Book Now Available!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/23/sql-server-2008-internals-book-now-available.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/23/sql-server-2008-internals-book-now-available.aspx</id><published>2009-03-23T17:28:05Z</published><updated>2009-03-23T17:28:05Z</updated><content type="html">For those of you waiting for the new &amp;quot;Inside SQL Server&amp;quot; book, it is actually out now.&amp;#160; Kalen decided to give it a name change, and the actual title is &amp;quot;SQL Server 2008 Internals&amp;quot;.&amp;#160; I've written a chapter on how the Query Optimizer works.&amp;#160; It is currently #1 in the 3 related database/sql server categories on Amazon, so I'll say &amp;quot;thank you&amp;quot; to those who have already ordered a copy ;).&amp;#160; Like my blog postings, there are a lot of sample scripts you can...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/23/sql-server-2008-internals-book-now-available.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9501374" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. Isolation Level Upgrade on UPDATE/DELETE Cascading RI</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/13/conor-vs-isolation-level-upgrade-on-update-delete-cascading-ri.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/13/conor-vs-isolation-level-upgrade-on-update-delete-cascading-ri.aspx</id><published>2009-03-13T18:12:52Z</published><updated>2009-03-13T18:12:52Z</updated><content type="html">A customer recently asked our support organization about an unexplained series of range locks that they were seeing on a DELETE to a table with a foreign key. Here is the repro: &amp;#160; 1: create table Foo (FooId int not null primary key ) 2: create table Bar (FooId int not null , BarId int not null ) 3: &amp;#160; 4: alter table Bar 5: add constraint PK_Bar 6: primary key (FooId, BarId) 7: &amp;#160; 8: alter table Bar 9: add constraint FK_Bar_Foo 10: foreign key (FooId) references Foo(FooId) 11: on delete...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/03/13/conor-vs-isolation-level-upgrade-on-update-delete-cascading-ri.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9473253" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author><category term="SQL" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/SQL/default.aspx" /><category term="locking" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/locking/default.aspx" /><category term="DELETE" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/DELETE/default.aspx" /><category term="CASCADING RI" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/CASCADING+RI/default.aspx" /></entry><entry><title>Conor vs. Indexed View Updates</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/12/conor-vs-indexed-view-updates.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/12/conor-vs-indexed-view-updates.aspx</id><published>2009-02-13T01:15:11Z</published><updated>2009-02-13T01:15:11Z</updated><content type="html">(as ANSI NULLs is one of the requirements for indexed views, I thought I’d give you some perspective on why the questions I ask you are useful and interesting to better understand queries and various query operations) &amp;#160; As currently designed, indexed views tries to strike a balance among: 1. query shapes that can be efficiently matched 2. query shapes that can be efficiently maintained 3. query shapes that can be efficiently created &amp;#160; Loosely speaking, indexed views work for basic SPJG...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/12/conor-vs-indexed-view-updates.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9416023" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author></entry><entry><title>Conor vs. Non-ANSI NULLs, part 1</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/08/conor-vs-non-ansi-nulls-part-1.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/08/conor-vs-non-ansi-nulls-part-1.aspx</id><published>2009-02-09T07:45:00Z</published><updated>2009-02-09T07:45:00Z</updated><content type="html">I was thinking about indexed views. Well, more specifically, I was thinking about why indexed views are hard to use. One of the reasons that they are hard is that there are just so many restrictions. Anyways, one of the things I'd like to better understand is how many customers actually use ANSI NULLs OFF and specifically _why_ do you use it? The typical reason we would expect is legacy applications (and that's a fine reason), but I am curious if there is more to it than just this. So, you know the...(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/08/conor-vs-non-ansi-nulls-part-1.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9407981" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author><category term="SQL" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/SQL/default.aspx" /><category term="ANSI" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/ANSI/default.aspx" /><category term="ANSI_NULL" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/ANSI_5F00_NULL/default.aspx" /></entry><entry><title>Conor vs. MERGE and PRIMARY KEY collisions</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/04/conor-vs-merge-and-primary-key-collisions.aspx" /><id>http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/04/conor-vs-merge-and-primary-key-collisions.aspx</id><published>2009-02-05T05:51:30Z</published><updated>2009-02-05T05:51:30Z</updated><content type="html">MERGE is a new operation added in SQL Server 2008. It has all sorts of knobs, bells, and whistles. The primary value of this feature is to collapse multiple query statements into one query statement. Overall, this avoids the “overhead” necessary to run a query a few times and can be a big benefit, especially when running many small queries that do things like “if exists then update else insert”. I received a natural question this week on the behavior of MERGE with respect to locks and transactions....(&lt;a href="http://blogs.msdn.com/conor_cunningham_msft/archive/2009/02/04/conor-vs-merge-and-primary-key-collisions.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9397362" width="1" height="1"&gt;</content><author><name>Conor Cunningham [MSFT]</name><uri>http://blogs.msdn.com/members/Conor+Cunningham+%5bMSFT%5d.aspx</uri></author><category term="SQL" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/SQL/default.aspx" /><category term="MERGE" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/MERGE/default.aspx" /><category term="locking" scheme="http://blogs.msdn.com/conor_cunningham_msft/archive/tags/locking/default.aspx" /></entry></feed>