December 18, 2014 at 2:41 pm
Just have 1 quick question. As far as I understand that SQL Server keeps the plan for constantly running queries, SP etc, so does SQL Server have the same or different plan for these SQL Statements.
(@P0 bigint,@P1 bigint)
SELECT "VALUE" AS Audit_Object_Type
FROM field_enum_values
WHERE fieldId = @P0
AND enumId = @P1
(@P0 bigint,@P1 bigint)
SELECT "VALUE" AS Field_Type
FROM field_enum_values
WHERE fieldId = @P0
AND enumId = @P1
"He who learns for the sake of haughtiness, dies ignorant. He who learns only to talk, rather than to act, dies a hyprocite. He who learns for the mere sake of debating, dies irreligious. He who learns only to accumulate wealth, dies an atheist. And he who learns for the sake of action, dies a mystic."[/i]
December 18, 2014 at 3:18 pm
Not sure. I suggest running both queries and then looking at the plan cache:
SELECT ecp.usecounts, ecp.cacheobjtype, ecp.objtype, est.text
FROM sys.dm_exec_cached_plans ecp
CROSS APPLY sys.dm_exec_sql_text(plan_handle) est
WHERE est.text LIKE '%field_enum_values%'
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
December 19, 2014 at 3:25 am
It's probably the same plan, but there will be two of them because you have what would be considered two different queries because of the different aliases.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
December 19, 2014 at 4:46 am
Different entries in the plan cache, very likely the same plan form, but two different plan objects in cache.
The queries would have to be an exact text match to have the same plan entry in cache.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply