• <output id="i6hun"><strong id="i6hun"><xmp id="i6hun"></xmp></strong></output><table id="i6hun"><strike id="i6hun"></strike></table>
        1. <table id="i6hun"><option id="i6hun"></option></table>
          <acronym id="i6hun"><strong id="i6hun"><xmp id="i6hun"></xmp></strong></acronym>

          通州北大青鳥學術部:SQL Server查詢語句設計實例解讀

          通州北大青鳥學術部提供:在執行一個查詢時,用一個where子句來限制必須處理的行數,除非完全需要,否則應該避免在一個表中無限制地讀并處理所有的行。

          例如下面的例子,
          select qty from sales where stor_id=7131

          是很有效的比下面這個無限制的查詢
          select qty from sales

          避免給客戶的最后數據選擇返回大量的結果集。允許SQL Server運行滿足它目的的函數限制結果集的大小是更有效的。(通州北大青鳥

          這能減少網絡I/O并能提高多用戶的相關并發時的應用程序性能。因為優化器關注的焦點就是where子句的查詢,以利用有用的索引。在表中的每一個索引都可能成為包括在where子句中的侯選索引。為了最好的性能可以遵照下面的用于一個給定列column1的索引。

          在表中的column1列上有一個單索引
          在表中有多索引,但是column1是第一個索引的列不要在where子句中使用沒有column1列索引的查詢語句,并避免在where子句用一個多索引的非第一個索引的索引。這時多索引是沒有用的。(通州北大青鳥
          For example, given a multicolumn index on the au_lname, au_fname columns of the authors table in the pubs database,

          下面這個query語句利用了au_lname上的索引
          SELECT au_id, au_lname, au_fname FROM authors
          WHERE au_lname = ’White’
          AND au_fname = ’Johnson’
          SELECT au_id, au_lname, au_fname FROM authors
          WHERE au_lname = ’White’
           
          下面這個查詢沒有利用索引,因為他使用了多索引的非第一個索引的索引(通州北大青鳥
          SELECT au_id, au_lname, au_fname FROM authors
          WHERE au_fname = ’Johnson’
          通州北大青鳥

          北大青鳥網上報名
          北大青鳥招生簡章
          自拍偷拍2018视频
        2. <output id="i6hun"><strong id="i6hun"><xmp id="i6hun"></xmp></strong></output><table id="i6hun"><strike id="i6hun"></strike></table>
              1. <table id="i6hun"><option id="i6hun"></option></table>
                <acronym id="i6hun"><strong id="i6hun"><xmp id="i6hun"></xmp></strong></acronym>