Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL query optimization i sql server 2005 [modified]

SQL query optimization i sql server 2005 [modified]

Scheduled Pinned Locked Moved Database
databasesql-serversysadminalgorithmsperformance
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashok techxygen
    wrote on last edited by
    #1

    Hi all, how to use query optimization in sql server 2005 for an efficient query. :)

    Ash

    modified on Friday, March 28, 2008 1:48 AM

    J 1 Reply Last reply
    0
    • A ashok techxygen

      Hi all, how to use query optimization in sql server 2005 for an efficient query. :)

      Ash

      modified on Friday, March 28, 2008 1:48 AM

      J Offline
      J Offline
      John_Adams
      wrote on last edited by
      #2

      Hi Ash, Here are some of the methods that most of the DBA's use to optimise the speed of MS SWL Server queries: -Display the minimum number of fields in a query. Set criteria dependant fields that are not required in the dynaset to "not shown". -Index all restriction based fields, all fields included in expressions, all sorted fields and all join fields. -Use primary keys or unique indexes wherever possible. -Use numeric rather than text primary keys. -Use non blank unique fields. -Avoid the use of IIf() function in queries. -Avoid domain aggregate functions such as Dlookup(). -Make careful use of Between and Equal to, rather than > or < speeds up queries. -Use fixed column headings in Crosstab queries. -For reports based on queries use Portrait view in preference to Landscape and select Fast Laser Printing to Yes (View,Options,Other Properties). -Use Make table queries for running reports on static data. These are called snapshot reports. -Use Count (*) rather than Count(Column). -When creating restrictions on a joined column in one-to-many relationships, test out the comparative performance when placing the restriction on the "one" side or the "many" side. The "one" side is not always the fastest - the "many" may have markedly fewer records. -Short table and field names run faster than long names. -Normalise tables - join strategies execute more quickly on smaller tables. -Denormalise tables - reduce the number of joins. Get the balance right between normalisation and denormalisation by experiment. -Avoid the use of Distinct Row queries - Union queries do not need the distinct row feature as they are automatically return unique fields unless set to Union All. You may visit the following link for more details about queyr optimization techniques. http://blogs.msdn.com/QueryOptTeam/[^] Hope this helps :).

      Regards, John Adams ComponentOne LLC

      G 1 Reply Last reply
      0
      • J John_Adams

        Hi Ash, Here are some of the methods that most of the DBA's use to optimise the speed of MS SWL Server queries: -Display the minimum number of fields in a query. Set criteria dependant fields that are not required in the dynaset to "not shown". -Index all restriction based fields, all fields included in expressions, all sorted fields and all join fields. -Use primary keys or unique indexes wherever possible. -Use numeric rather than text primary keys. -Use non blank unique fields. -Avoid the use of IIf() function in queries. -Avoid domain aggregate functions such as Dlookup(). -Make careful use of Between and Equal to, rather than > or < speeds up queries. -Use fixed column headings in Crosstab queries. -For reports based on queries use Portrait view in preference to Landscape and select Fast Laser Printing to Yes (View,Options,Other Properties). -Use Make table queries for running reports on static data. These are called snapshot reports. -Use Count (*) rather than Count(Column). -When creating restrictions on a joined column in one-to-many relationships, test out the comparative performance when placing the restriction on the "one" side or the "many" side. The "one" side is not always the fastest - the "many" may have markedly fewer records. -Short table and field names run faster than long names. -Normalise tables - join strategies execute more quickly on smaller tables. -Denormalise tables - reduce the number of joins. Get the balance right between normalisation and denormalisation by experiment. -Avoid the use of Distinct Row queries - Union queries do not need the distinct row feature as they are automatically return unique fields unless set to Union All. You may visit the following link for more details about queyr optimization techniques. http://blogs.msdn.com/QueryOptTeam/[^] Hope this helps :).

        Regards, John Adams ComponentOne LLC

        G Offline
        G Offline
        Gandalf_TheWhite
        wrote on last edited by
        #3

        That was a good answer!! covered lots of things. thanks for sharing

        Believe Yourself™

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups