Click here to Skip to main content
15,902,112 members
Home / Discussions / Database
   

Database

 
GeneralRe: Select first entries in a table matching given criteria Pin
Jörgen Andersson27-May-13 11:12
professionalJörgen Andersson27-May-13 11:12 
QuestionWindows accounts for SSE Pin
Richard.Berry10025-May-13 22:35
Richard.Berry10025-May-13 22:35 
QuestionVA Database Pin
Daaron24-May-13 4:10
Daaron24-May-13 4:10 
QuestionRe: VA Database Pin
Eddy Vluggen24-May-13 4:18
professionalEddy Vluggen24-May-13 4:18 
AnswerRe: VA Database Pin
jschell24-May-13 12:40
jschell24-May-13 12:40 
AnswerRe: VA Database Pin
Richard MacCutchan24-May-13 4:19
mveRichard MacCutchan24-May-13 4:19 
AnswerRe: VA Database Pin
R. Giskard Reventlov24-May-13 5:15
R. Giskard Reventlov24-May-13 5:15 
GeneralRe: VA Database Pin
PIEBALDconsult24-May-13 11:45
mvePIEBALDconsult24-May-13 11:45 
AnswerRe: VA Database Pin
jschell24-May-13 12:43
jschell24-May-13 12:43 
QuestionCreate Mysql Music Database Help Pin
Muveen_Delhi23-May-13 22:28
Muveen_Delhi23-May-13 22:28 
AnswerRe: Create Mysql Music Database Help Pin
Eddy Vluggen24-May-13 3:02
professionalEddy Vluggen24-May-13 3:02 
GeneralRe: Create Mysql Music Database Help Pin
Muveen_Delhi24-May-13 18:08
Muveen_Delhi24-May-13 18:08 
GeneralRe: Create Mysql Music Database Help Pin
Mycroft Holmes26-May-13 12:51
professionalMycroft Holmes26-May-13 12:51 
QuestionINSERT - SELECT QUERY Help Needed. Pin
codingrocks23-May-13 9:00
codingrocks23-May-13 9:00 
AnswerRe: INSERT - SELECT QUERY Help Needed. Pin
Mycroft Holmes23-May-13 11:15
professionalMycroft Holmes23-May-13 11:15 
QuestionHey need help of adding data T__T Pin
Al Arcilla23-May-13 4:54
Al Arcilla23-May-13 4:54 
AnswerRe: Hey need help of adding data T__T Pin
Simon_Whale23-May-13 5:16
Simon_Whale23-May-13 5:16 
AnswerRe: Hey need help of adding data T__T Pin
Eddy Vluggen24-May-13 0:23
professionalEddy Vluggen24-May-13 0:23 
AnswerRe: Hey need help of adding data T__T Pin
Al Arcilla26-May-13 3:50
Al Arcilla26-May-13 3:50 
Questiondisributed database (in one computer(at sql 2008)/two server)؟? Pin
22majid2222-May-13 19:44
22majid2222-May-13 19:44 
AnswerRe: disributed database (in one computer(at sql 2008)/two server)؟? Pin
Mycroft Holmes22-May-13 22:07
professionalMycroft Holmes22-May-13 22:07 
QuestionSelect in SP slower than non-SP ? Pin
Saxet22-May-13 7:16
Saxet22-May-13 7:16 
I have this SQL Server 2012 trivial stored procedure:
SQL
CREATE PROCEDURE usp_SelectCompany
AS
BEGIN
	SET NOCOUNT ON
	SELECT * FROM Company
END

and in a SSMS window, I execute this commands below to discover my SP is much slower than directly executing SELECT * from Company, even after the SP is run once to compile it.
SQL
-- create temp table so SSMS results output doesn't interfere too much with with query execution time 
SELECT * INTO #Company FROM Company WHERE 1=0

-- run the SP once to ensure that is is compiled
INSERT #Company EXEC usp_SelectCompany

PRINT 'Start Time:  ' + cast(sysdatetime() as varchar)
INSERT #Company EXEC usp_SelectCompany
PRINT 'SP Time:     ' + cast(sysdatetime() as varchar)
INSERT #Company SELECT * FROM Company
PRINT 'Select Time: ' + cast(sysdatetime() as varchar)

Here is the output:
(0 row(s) affected)

(127733 row(s) affected)
Start Time:  2013-05-22 11:56:57.7208741

(127733 row(s) affected)
SP Time:     2013-05-22 11:57:03.2067327

(127733 row(s) affected)
Select Time: 2013-05-22 11:57:04.0015524

I note that the SP executes in 5.4858586 seconds, and the direct "select" statement only takes 0.7948197 seconds, or about 7 times slower.

Can anyone explain this behavior?
QuestionRe: Select in SP slower than non-SP ? Pin
Eddy Vluggen22-May-13 7:36
professionalEddy Vluggen22-May-13 7:36 
AnswerRe: Select in SP slower than non-SP ? Pin
Saxet22-May-13 8:03
Saxet22-May-13 8:03 
GeneralRe: Select in SP slower than non-SP ? Pin
Eddy Vluggen22-May-13 8:20
professionalEddy Vluggen22-May-13 8:20 

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.