DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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
    >
    >




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links