Click here to Skip to main content
15,917,991 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL query to read all the records one by one Pin
Yvon Bourgouin9-Jun-10 3:53
Yvon Bourgouin9-Jun-10 3:53 
GeneralRe: SQL query to read all the records one by one Pin
R. Giskard Reventlov9-Jun-10 4:45
R. Giskard Reventlov9-Jun-10 4:45 
AnswerRe: SQL query to read all the records one by one Pin
Scubapro9-Jun-10 4:50
Scubapro9-Jun-10 4:50 
GeneralRe: SQL query to read all the records one by one Pin
Yvon Bourgouin9-Jun-10 4:58
Yvon Bourgouin9-Jun-10 4:58 
GeneralRe: SQL query to read all the records one by one Pin
Johan Hakkesteegt10-Jun-10 3:09
Johan Hakkesteegt10-Jun-10 3:09 
GeneralRe: SQL query to read all the records one by one Pin
supercat99-Jun-10 5:43
supercat99-Jun-10 5:43 
GeneralRe: SQL query to read all the records one by one Pin
Yvon Bourgouin9-Jun-10 8:55
Yvon Bourgouin9-Jun-10 8:55 
GeneralRe: SQL query to read all the records one by one Pin
David Skelly9-Jun-10 5:44
David Skelly9-Jun-10 5:44 
Yvon Bourgouin wrote:
At the beginning, it's quite fast but the performances are degrading quite fast


I'm not surprised. Think about what you are asking the database to do here:

SELECT TOP 200...

SELECT TOP 200 WHERE NOT IN (SELECT TOP 200...)

SELECT TOP 200 WHERE NOT IN (SELECT TOP 400...)

SELECT TOP 200 WHERE NOT IN (SELECT TOP 600...)

... repeat lots of times ...

SELECT TOP 200 WHERE NOT IN (SELECT TOP 1,000,000...)

If I understand you correctly, you are running the same query over and over, asking the database to do more work every time.

You say that you are only processing a small number of the rows. So, why fetch them all? Why not put something into the WHERE clause to cut down the number of rows you select? Once you have fetched these rows, how do you decide which ones you will process and which ones you will ignore and what is stopping you from moving that selection logic back to the database? Sorry if that's obvious, I'm sure you have considered it, but I don't quite understand why you don't do that.
GeneralRe: SQL query to read all the records one by one Pin
i.j.russell9-Jun-10 8:20
i.j.russell9-Jun-10 8:20 
GeneralRe: SQL query to read all the records one by one Pin
Yvon Bourgouin9-Jun-10 8:53
Yvon Bourgouin9-Jun-10 8:53 
AnswerRe: SQL query to read all the records one by one Pin
J4amieC9-Jun-10 4:54
J4amieC9-Jun-10 4:54 
QuestionMS SQL permissions mangement Pin
T M Gray8-Jun-10 10:21
T M Gray8-Jun-10 10:21 
AnswerRe: MS SQL permissions mangement Pin
Mycroft Holmes8-Jun-10 15:07
professionalMycroft Holmes8-Jun-10 15:07 
GeneralRe: MS SQL permissions mangement Pin
T M Gray9-Jun-10 8:06
T M Gray9-Jun-10 8:06 
GeneralRe: MS SQL permissions mangement Pin
Mycroft Holmes9-Jun-10 12:52
professionalMycroft Holmes9-Jun-10 12:52 
QuestionDatabase Size Pin
It_tech8-Jun-10 5:38
It_tech8-Jun-10 5:38 
AnswerRe: Database Size Pin
Mycroft Holmes8-Jun-10 15:02
professionalMycroft Holmes8-Jun-10 15:02 
GeneralRe: Database Size Pin
It_tech8-Jun-10 21:26
It_tech8-Jun-10 21:26 
GeneralRe: Database Size Pin
Mycroft Holmes8-Jun-10 22:35
professionalMycroft Holmes8-Jun-10 22:35 
Questionunresolved external symbol sqlcxt Pin
ravi1204868-Jun-10 1:02
ravi1204868-Jun-10 1:02 
AnswerRe: unresolved external symbol sqlcxt Pin
Chris Meech8-Jun-10 7:14
Chris Meech8-Jun-10 7:14 
QuestionTriggers Pin
Morgs Morgan7-Jun-10 3:28
Morgs Morgan7-Jun-10 3:28 
AnswerRe: Triggers Pin
Mycroft Holmes7-Jun-10 4:33
professionalMycroft Holmes7-Jun-10 4:33 
GeneralRe: Triggers Pin
Morgs Morgan7-Jun-10 5:42
Morgs Morgan7-Jun-10 5:42 
AnswerRe: Triggers Pin
dan!sh 7-Jun-10 5:16
professional dan!sh 7-Jun-10 5:16 

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.