dbTalk Databases Forums  

Text column in select query

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Text column in select query in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rogers
 
Posts: n/a

Default Text column in select query - 03-26-2007 , 11:47 AM






I have a text column table and that contains 3000 records but when I try to
use top 10 query and include text column it take 10 minutes and when I
remove the text column from the select query it takes a second, any idea how
we can speed up the query if I include text column in my list.



Reply With Quote
  #2  
Old   
Russell Fields
 
Posts: n/a

Default Re: Text column in select query - 03-26-2007 , 01:49 PM






Rogers,

You don't mention what you are ordering by (and perhaps also grouping by),
but assuming that the text column is not included in the ORDER BY or GROUP
BY clauses:

SELECT TOP 10 ID, colA, colB, colC
INTO #temp
FROM MyTable
ORDER BY colC, colB, colA

SELECT t.colA, t.colB, t.colC, m.textcolumn
FROM #temp t JOIN MyTable m
ON t.ID = m.ID
ORDER BY colC, colB, colA

This simply gets the text column out of the TOP 10, but returns it from the
second select.

RLF
"Rogers" <naissani (AT) hotmail (DOT) com> wrote

Quote:
I have a text column table and that contains 3000 records but when I try to
use top 10 query and include text column it take 10 minutes and when I
remove the text column from the select query it takes a second, any idea
how we can speed up the query if I include text column in my list.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.