'Order by' clause will reduce performance ?
Dear all
I am using SQL-Server database,
but i have a strange problem,
I have one Visual Basic application which query from database
every 100 ms. The query is very simple like:
select top 10 *
from tableX
Everything is OK, but when i add 'order by' clause,
the CPU-usage of my database server become very high,
i just changed the query to:
select top 10 *
from tableX
order by number
Anybody can help me, please ?
thanks
Agus
Re: 'Order by' clause will reduce performance ?
If you can create a clustered index on number. If not, create a
non-clustered index on number.
Then try it again...
--
HTH,
David Satz
SQL Server MVP
Principal Software Engineer
Hyperion Solutions
{ SQL Server 2000 SP1/7.0 SP3/6.5 SP5a } { Cold Fusion 5/4.5.1 SP2 } { VSS }
(Please reply to group only - emails answered rarely)
-----------------------------------------------------------------
"Agus Susanto" <aguss@intouch.com.sg> wrote in message
news:3b947896$1@news.devx.com...
>
> Dear all
>
> I am using SQL-Server database,
> but i have a strange problem,
> I have one Visual Basic application which query from database
> every 100 ms. The query is very simple like:
>
> select top 10 *
> from tableX
>
> Everything is OK, but when i add 'order by' clause,
> the CPU-usage of my database server become very high,
> i just changed the query to:
>
> select top 10 *
> from tableX
> order by number
>
> Anybody can help me, please ?
>
> thanks
> Agus
>
>