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 12345»»»

Queries Expand / Collapse
Author
Message
Posted Tuesday, November 27, 2012 9:01 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 11:24 AM
Points: 2,040, Visits: 2,041
Comments posted to this topic are about the item Queries
Post #1389492
Posted Tuesday, November 27, 2012 9:15 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, June 24, 2014 6:38 PM
Points: 1,371, Visits: 1,560
I was completely not able to get this question!
Could have been phrased better..


~ Lokesh Vij

Guidelines for quicker answers on T-SQL question
Guidelines for answers on Performance questions

Link to my Blog Post --> www.SQLPathy.com

Follow me @Twitter

Post #1389494
Posted Tuesday, November 27, 2012 9:58 PM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, August 12, 2014 10:57 PM
Points: 458, Visits: 857
I guessed 7 and got it wrong.

I've just created a test database to try this.
Including actual execution plan shows nothing...
displaying estimated execution plan shows 8 queries, however, these 2 are counted as 1:

SET QUOTED_IDENTIFIER ON; SET ARITHABORT ON;

And both
BEGIN TRAN 

and
COMMIT 

are counted as queries in their own right. I suppose that's fair.

Interestingly, if you move QUOTED_IDENTIFIER to be the last one, estimated query plan counts it and COMMIT together as one query. I tried that hoping to see it say 9 queries but not what I expected at all. Seems like yet another quirk of the estimated query plan to me rather than being anything useful regarding the nature of the commands.



I hope someone can elaborate on this.
Post #1389503
Posted Tuesday, November 27, 2012 11:26 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 12:34 AM
Points: 1,888, Visits: 2,326
Not able to get the today's question


_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1389517
Posted Tuesday, November 27, 2012 11:47 PM


SSC Eights!

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

Group: General Forum Members
Last Login: Yesterday @ 11:49 PM
Points: 833, Visits: 1,365
Well, this question definitely has more than one correct answer. If you look at the actual execution plan, the correct answer is 0.



Ole Kristian Velstadbråten Bangås - Virinco - Facebook - Twitter

Concatenating Row Values in Transact-SQL
Post #1389521
Posted Wednesday, November 28, 2012 12:16 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:21 AM
Points: 13,603, Visits: 10,477
The only correct answer is 0.
There are 8 statements in the estimated execution plan, but no queries.

From BOL:

A query is a request for data that is stored in SQL Server.


Query Fundamentals

There isn't a single statement in the batch that does a request for data, hence no queries.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1389529
Posted Wednesday, November 28, 2012 12:19 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, July 25, 2014 12:34 AM
Points: 1,888, Visits: 2,326
I select 0 option but get it wrong...


_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1389530
Posted Wednesday, November 28, 2012 12:23 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 2:42 AM
Points: 3,012, Visits: 910
That was ...



... interesting



Just because you're right doesn't mean everybody else is wrong.
Post #1389533
Posted Wednesday, November 28, 2012 12:29 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 2:50 AM
Points: 1,317, Visits: 479
And what shall we learn from that?
Post #1389537
Posted Wednesday, November 28, 2012 12:36 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, August 6, 2014 12:09 AM
Points: 302, Visits: 178
I agree with Koen. Those are statements. As the estimated execution plan doesn't know better it will divide this up into 8 parts. Why the quoted_identifier setting always will go with the next statement is beyond me, but is of no consequense for the answer.

As we have learned before, the estimated execution plan can lie to us, e.g. because of function calls. I would say that the actual execution plan is the only non-lying report of this query batch, and as stated previously, the actual number of queries against the engine is 0.
Post #1389542
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse