Efficient Query

  • Hi All,

    Is there any way to conclude that the given query is efficient?

    Thanks and Regards,

    N.Prabhakaran

  • Look at the execution plan....

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • [font="Verdana"]Look at the Execution Time, right bottom hand ... :D[/font]

    MH-09-AM-8694

  • as the others have said look at the execution plan and time.

    Other general ideas are;

    Avoid costly queries in your procedure, avoid cursors and try and use a set based solution rather that processing data per row.

    Ensure you have a appropriate indexes on your table.

    Dont select more columns or rows than you need.

    Dont have un-neccesary joins

  • It's efficient when your users aren't complaining that its slow 🙂

  • What everyone else has said plus, assuming an OLTP system, you're avoiding scans, bookmark lookups (key lookups) and ineffecient joins in the queries. Assuming a reporting system, you're avoiding scans (the rest seem to be a part of the cost of operations).

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply