Click here to Skip to main content
16,005,080 members
Home / Discussions / Database
   

Database

 
AnswerRe: textbox help Pin
Richard MacCutchan1-Feb-16 22:00
mveRichard MacCutchan1-Feb-16 22:00 
Questionbinding a textbox Pin
Member 122873371-Feb-16 2:38
Member 122873371-Feb-16 2:38 
Questionstoring image in blob vs text? Pin
Jassim Rahma30-Jan-16 9:34
Jassim Rahma30-Jan-16 9:34 
AnswerRe: storing image in blob vs text? Pin
Mycroft Holmes30-Jan-16 12:36
professionalMycroft Holmes30-Jan-16 12:36 
GeneralRe: storing image in blob vs text? Pin
Eddy Vluggen30-Jan-16 23:40
professionalEddy Vluggen30-Jan-16 23:40 
AnswerRe: storing image in blob vs text? Pin
Eddy Vluggen30-Jan-16 23:39
professionalEddy Vluggen30-Jan-16 23:39 
AnswerRe: storing image in blob vs text? Pin
Jörgen Andersson30-Jan-16 23:57
professionalJörgen Andersson30-Jan-16 23:57 
QuestionSQL Server Query Plan Cache Behavior Pin
Foothill28-Jan-16 10:18
professionalFoothill28-Jan-16 10:18 
Long story short, after reviewing server statistics after a large data conversion, I noticed that parameterized queries were being stored in plan cache thousands of times. Isn't parametrizing your queries supposed to prevent that?

Example offending query:
SQL
INSERT INTO AddressTable (ObjectId, IsMailing, Street1, Street2, City, State, PostalCode, County, Country) 
VALUES (@ObjectId, @IsMailing, @Street1, @Street2, @City, @State, @PostalCode, @County, @Country);

The ObjectId is a Foreign Key (INT), IsMailing is a boolean (BIT), and the rest are NVARCHAR(X).

There were 38K+ records inserted into the table (one at a time) and there are ~3400 plans of this query cached in the plan cache. The conversion procedure is a custom application written in C# that generates the insert statements on the fly depending on what is being inserted but all the ad-hoc queries are identical for a given table. On a side note, the program was executing statements against the database across 70 to 80 separate threads concurrently (yay multi-threading).

Basically, my question is why would identical parameterized queries executed thousands of times create thousands of separate query plans? And is there any settings to change to prevent that?
if (Object.DividedByZero == true) { Universe.Implode(); }

AnswerRe: SQL Server Query Plan Cache Behavior Pin
Jörgen Andersson29-Jan-16 3:49
professionalJörgen Andersson29-Jan-16 3:49 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Foothill29-Jan-16 4:14
professionalFoothill29-Jan-16 4:14 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Jörgen Andersson29-Jan-16 4:25
professionalJörgen Andersson29-Jan-16 4:25 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Foothill29-Jan-16 4:32
professionalFoothill29-Jan-16 4:32 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Jörgen Andersson29-Jan-16 4:33
professionalJörgen Andersson29-Jan-16 4:33 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Foothill29-Jan-16 4:45
professionalFoothill29-Jan-16 4:45 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Richard Deeming29-Jan-16 5:10
mveRichard Deeming29-Jan-16 5:10 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Foothill29-Jan-16 5:15
professionalFoothill29-Jan-16 5:15 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Jörgen Andersson29-Jan-16 10:45
professionalJörgen Andersson29-Jan-16 10:45 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Foothill29-Jan-16 11:17
professionalFoothill29-Jan-16 11:17 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Jörgen Andersson29-Jan-16 11:42
professionalJörgen Andersson29-Jan-16 11:42 
GeneralRe: SQL Server Query Plan Cache Behavior Pin
Foothill29-Jan-16 12:51
professionalFoothill29-Jan-16 12:51 
Questiondata base and data mining Pin
mohammed.alchalabee28-Jan-16 7:48
mohammed.alchalabee28-Jan-16 7:48 
QuestionRe: data base and data mining Pin
ZurdoDev28-Jan-16 8:48
professionalZurdoDev28-Jan-16 8:48 
AnswerRe: data base and data mining Pin
Eddy Vluggen29-Jan-16 2:12
professionalEddy Vluggen29-Jan-16 2:12 
QuestionSqlconnection Pin
Member 1228733728-Jan-16 4:13
Member 1228733728-Jan-16 4:13 
Answer[REPOST] Sqlconnection Pin
Richard Deeming28-Jan-16 4:27
mveRichard Deeming28-Jan-16 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.