'Order by' clause will reduce performance ?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: 'Order by' clause will reduce performance ?

  1. #1
    Agus Susanto Guest

    '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



  2. #2
    DaveSatz Guest

    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
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center