Click here to Skip to main content
15,898,373 members
Home / Discussions / Database
   

Database

 
GeneralRe: sql server locking mechanism Pin
Ashfield27-May-08 21:36
Ashfield27-May-08 21:36 
QuestionUpdate an image field Pin
imannasr27-May-08 18:55
imannasr27-May-08 18:55 
AnswerRe: Update an image field Pin
Christian Graus28-May-08 14:28
protectorChristian Graus28-May-08 14:28 
NewsSQL Server 2008 Jumpstart Event Dev Training Now Online Pin
brucedkyle27-May-08 16:16
brucedkyle27-May-08 16:16 
QuestionIncorrect syntax on output parameter? [modified] Pin
markymark8227-May-08 10:34
markymark8227-May-08 10:34 
AnswerRe: Incorrect syntax on output parameter? Pin
Christian Graus27-May-08 14:25
protectorChristian Graus27-May-08 14:25 
GeneralRe: Incorrect syntax on output parameter? Pin
markymark8228-May-08 0:02
markymark8228-May-08 0:02 
QuestionVery slow ORDER BY Pin
legionnaire27-May-08 7:23
legionnaire27-May-08 7:23 
Hey there,

I'm having a little issue with a query. Basically I'm trying to do some paging. There's many ways to do it, I know, but what I came up with was this:

SELECT TOP 10 columnA, columnB
FROM table
WHERE columnA not in (
SELECT TOP 21190 columnA
FROM table
ORDER BY columnC DESC)
ORDER BY columnC DESC

Some notes about it:
columnA is the key
columnD, columnC and columnA are index1
columnD and columnA are index2
columnC is index3.
In SELECT TOP 21190, that number is pageNumber * pageSize

Now... it seems that the very last 'ORDER BY columnC DESC'is the problem. Like it is the query takes around 1 minute to run. If I take that line out, the query runs in less than a second. Or, if I change the ORDER BY to be done by columnA, it also runs in less than a second.

Any ideas?
AnswerRe: Very slow ORDER BY Pin
Christian Graus27-May-08 14:26
protectorChristian Graus27-May-08 14:26 
QuestionVisual Studio Server Explorer issue... [modified] Pin
Rombolt27-May-08 6:21
Rombolt27-May-08 6:21 
QuestionUploading a website with a database Pin
Mohammad A Gdeisat27-May-08 5:36
Mohammad A Gdeisat27-May-08 5:36 
AnswerRe: Uploading a website with a database Pin
Krazy Programmer27-May-08 7:32
Krazy Programmer27-May-08 7:32 
Questionsql server connection?????or login with query analyzer???????????? Pin
mr.mohsen27-May-08 3:39
mr.mohsen27-May-08 3:39 
AnswerRe: sql server connection?????or login with query analyzer???????????? Pin
Mark J. Miller29-May-08 4:09
Mark J. Miller29-May-08 4:09 
QuestionSQL server 2008 – The latest version with improved performance on BI (video) Pin
zola112527-May-08 0:51
zola112527-May-08 0:51 
AnswerRe: SQL server 2008 – The latest version with improved performance on BI (video) Pin
yoei27-May-08 1:11
yoei27-May-08 1:11 
QuestionTriggers in SQLSERVER Pin
sukkureddy26-May-08 23:13
sukkureddy26-May-08 23:13 
AnswerRe: Triggers in SQLSERVER Pin
Ashfield26-May-08 23:27
Ashfield26-May-08 23:27 
QuestionAdvance Search Pin
Mogaambo26-May-08 21:31
Mogaambo26-May-08 21:31 
AnswerRe: Advance Search Pin
Blue_Boy26-May-08 22:27
Blue_Boy26-May-08 22:27 
GeneralRe: Advance Search Pin
Mogaambo26-May-08 22:54
Mogaambo26-May-08 22:54 
QuestionLet me know abot Sql Server security... Pin
PadmaPriya.S26-May-08 21:21
PadmaPriya.S26-May-08 21:21 
AnswerRe: Let me know abot Sql Server security... Pin
Ashfield26-May-08 21:27
Ashfield26-May-08 21:27 
GeneralRe: Let me know abot Sql Server security... Pin
PadmaPriya.S26-May-08 21:32
PadmaPriya.S26-May-08 21:32 
GeneralRe: Let me know abot Sql Server security... Pin
Ashfield27-May-08 1:34
Ashfield27-May-08 1:34 

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.