Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

Books for Query Optimizer inner workings? Expand / Collapse
Author
Message
Posted Monday, January 4, 2010 8:00 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 2, 2014 1:19 PM
Points: 122, Visits: 273
Hi there,

I'm looking for a book to read about the inner workings of the query optimizer for SQL 2005 and 2008. I read about it whenever I can find stuff (eg. http://blogs.msdn.com/sqlqueryprocessing/) but it's not updated very often. BOL is a good start but I would love to find a book dedicated to the query optimizer that explains how it works, how it chooses certain plans over others etc.

Is there something out there that's dedicated to it and does not just have one chapter that talks about it in the middle of a more generale performance tuning book?

Thanks

Greg
Post #841488
Posted Monday, January 4, 2010 8:25 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, May 30, 2014 6:27 PM
Points: 2,808, Visits: 7,175
this book has some excellent information about the Optimizer

http://www.amazon.com/Microsoft-SQL-Server-2008-Internals/dp/0735626243/ref=pd_sim_b_2

infact the entire
Inside Microsoft SQL Server series is excellent in helping understand the internals of SQL server.
Post #841514
Posted Monday, January 4, 2010 8:28 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:15 PM
Points: 43,017, Visits: 36,179
I don't think there is a comprehensive book, as much of the internal workings, the costing algorithms etc, as far as I know are not public knowledge.

There's a large chapter in SQL 2008 Internals written by Conor Cunningham (one of the guys working on the optimiser), other than that there's some in Inside SQL Server 2005: Query Tuning and Optimisation, there's stuff scattered through Grant's book "SQL 2008 Query performance tuning distilled"

Also, while it's not specifically SQL server, it may be worth doing a search for academic papers on Query Optimisation. Try scholar.google.com as a starting point. It's really theoretical but if you are interested in this stuff it's worth a look.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #841519
Posted Monday, January 4, 2010 8:41 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 3:48 PM
Points: 879, Visits: 2,463
ducon (1/4/2010)
Hi there,

I would love to find a book dedicated to the query optimizer that explains how it works, how it chooses certain plans over others etc.
Greg


ISQL Server Execution Plans

It does give a background of the query optimizer and goes into detail about execution plans. Don't know if it is the detail you are looking for. Gail is right in that the true "internals" of the query optimizer are Microsoft trade secrets probably and not available to public. I have never come across anything detailed, but Grant's e-book is a good start.


Shawn Melton
PS C:\>(Find-Me).TwitterURL
@wsmelton
PS C:\>(Find-Me).BlogURL
meltondba.wordpress.com
Post #841528
Posted Monday, January 4, 2010 9:22 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 2, 2014 1:19 PM
Points: 122, Visits: 273
Hi,

Thanks for all the info, I will check these out. I'm pretty sure there's a fine line between giving enough information for people to make informed decisions and revealing your trade secrets as pointed out. However, I think it'd be pretty nice to know more about it as it may shape a lot in my indexing, data allocation strategies etc.

Greg
Post #841565
Posted Monday, January 4, 2010 9:36 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:15 PM
Points: 43,017, Visits: 36,179
There's enough information around for indexing strategies and the like. My blog's got some, all of the books I mention have lots on that. That's not what I'd call deep internals though.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #841575
Posted Monday, January 4, 2010 10:09 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, July 2, 2014 1:19 PM
Points: 122, Visits: 273
Yes, I agree with the fact that there is information online, but it's scattered all around and can be inconsistent between sources. That's what I want when I buy a book dedicated to a particular topic. I'm not looking into finding information that is impossible to find online.

Knowing how the query optimizer works will help shaping strategies regarding indexing etc. It's not necessarily deep internals but in my humble opinion:

1) it sure does not hurt (I always end up learning something new everytime I try something, even though I thought I knew how that worked)
2)I'm not sure how far you can get before hitting the "trade secret" wall in this topic
3) the definition of something "deep" is probably very relative to everyone's knowledge in this kind of area (and their needs as well)

I have enough database theory books in my shelves to understand how it's "supposed" to work from a maethematical point of view, but we've all seen cases where some queries are done in a certain way by the optimizer instead of the one we thought it ought to. The main drawbacks of these books is that they most of the time of course are RDBMS-independent, which is also their strength.

I'm pretty sure a book like the SQL Internals mentioned earlier is not entirely dedicated to that but I think that it can give some valuable information that may affect these decisions. Mind you, I haven't read it yet, nor do I own it.

Regards,

Greg
Post #841582
Posted Tuesday, January 5, 2010 7:04 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 5:59 PM
Points: 15,735, Visits: 28,141
Tossing another penny down the well, I'd go with the Internals books. I'd especially focus on T-SQL Querying book. It has a couple of chapters on how the optimizer works before it gets into all the other stuff of writing queries.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #842060
Posted Friday, June 17, 2011 4:58 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, October 16, 2013 4:03 PM
Points: 6, Visits: 146
Check out Benjamin Nevarez if you're still pursuing this. I had several exchanges with him a while back about how calculations were derived by the optimizer. This knowledge helped me figure out expected execution times. My last exchange if you're interested: http://sqlblog.com/blogs/ben_nevarez/archive/2009/09/11/how-the-query-optimizer-uses-statistics-part-ii.aspx

He ended up writing a book: http://www.amazon.com/Inside-SQL-Server-Query-Optimizer/dp/1906434603/ref=sr_1_11?ie=UTF8&qid=1301970045&sr=8-11

Good luck !

-Blake a.k.a CQLBoy


CQLBoy
Post #1127697
Posted Saturday, June 18, 2011 10:51 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Today @ 5:59 PM
Points: 15,735, Visits: 28,141
blake colson-405790 (6/17/2011)
Check out Benjamin Nevarez if you're still pursuing this. I had several exchanges with him a while back about how calculations were derived by the optimizer. This knowledge helped me figure out expected execution times. My last exchange if you're interested: http://sqlblog.com/blogs/ben_nevarez/archive/2009/09/11/how-the-query-optimizer-uses-statistics-part-ii.aspx

He ended up writing a book: http://www.amazon.com/Inside-SQL-Server-Query-Optimizer/dp/1906434603/ref=sr_1_11?ie=UTF8&qid=1301970045&sr=8-11

Good luck !

-Blake a.k.a CQLBoy


This thread is about 18 months old.

Benjamin's book is really excellent, and I'm saying that despite being the technical editor on it.


----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1127771
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse