Showing posts with label speed. Show all posts
Showing posts with label speed. Show all posts

Thursday, March 29, 2012

drastic change in speed

I was executing sp, which was taking time. I then dropped it and recreated
it. It started executing very fast.
Can Anyone have idea why this happens and what exactly happen when we drop
and recreate sp.When you drop SP it will cause to recompilation ( generating a new execution
plan). The same thing you might achive by creating a stored procedure WITH
RECOMPILE option
For more details see BOL
"Vikram" <aa@.aa> wrote in message
news:%23QQDPBcQGHA.1676@.TK2MSFTNGP14.phx.gbl...
>I was executing sp, which was taking time. I then dropped it and recreated
> it. It started executing very fast.
> Can Anyone have idea why this happens and what exactly happen when we drop
> and recreate sp.
>|||Also, before recompiling all the stored procedures, look into running DBCC
UPDATEUSAGE for critical tables. This will incure that the new execution
plans are compiled using the latest usage statistics.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:euJAtBdQGHA.2012@.TK2MSFTNGP14.phx.gbl...
> When you drop SP it will cause to recompilation ( generating a new
> execution plan). The same thing you might achive by creating a stored
> procedure WITH RECOMPILE option
> For more details see BOL
>
>
> "Vikram" <aa@.aa> wrote in message
> news:%23QQDPBcQGHA.1676@.TK2MSFTNGP14.phx.gbl...
>

Tuesday, February 14, 2012

does using sql parameters speed asp.net code up?

does using sql parameters speed asp.net code up?Depends on a lot of things. It's usually more secure than straight SQL code, which is what I'm assuming you're comparing this to. Also, if you are using stored procedures they are a bit speedier on the server side (but I don't know if you'd notice it, depends on the app).

But from a security perspective (to avoid SQL injection attacks), it's a good idea. IMHO|||I have a question about paramaters then.. I have only seen sample for INSERT how about UPDATE AND DELETE?

Here is my insert statement

SQL = "INSERT INTO table1(id, key_data) VALUES (@.ID, @.key)"

conn = New SQLConnection(SQLserver)
dbComm2 = New SqlCommand(SQL,conn)
dbComm2.Parameters.Add(New SqlParameter("@.ID", Session("id")))
dbComm2.Parameters.Add(New SqlParameter("@.key", KeyGeN))

How would i change these for delete and Update?

thanks|||xactly the same...just change your query


update table set col=@.var1, col2=@.var2 where col3=@.var3

then add the variables and their values like you did above

same for delete also

hth