亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? optimizer.tcl

?? 嵌入式數(shù)據(jù)庫,在嵌入式平臺上實現(xiàn)數(shù)據(jù)庫功能,沒有數(shù)據(jù)引擎,符合sql92標準
?? TCL
字號:
## Run this TCL script to generate HTML for the goals.html file.#set rcsid {$Id: optimizer.tcl,v 1.1 2005/08/30 22:44:06 drh Exp $}source common.tclheader {The SQLite Query Optimizer}proc CODE {text} {  puts "<blockquote><pre>"  puts $text  puts "</pre></blockquote>"}proc IMAGE {name {caption {}}} {  puts "<center><img src=\"$name\">"  if {$caption!=""} {    puts "<br>$caption"  }  puts "</center>"}proc PARAGRAPH {text} {  puts "<p>$text</p>\n"}proc HEADING {level name} {  puts "<h$level>$name</h$level>"}HEADING 1 {The SQLite Query Optimizer}PARAGRAPH {  This article describes how the SQLite query optimizer works.  This is not something you have to know in order to use SQLite - many  programmers use SQLite successfully without the slightest hint of what  goes on in the inside.  But a basic understanding of what SQLite is doing  behind the scenes will help you to write more efficient SQL.  And the  knowledge gained by studying the SQLite query optimizer has broad  application since most other relational database engines operate   similarly.  A solid understanding of how the query optimizer works is also  required before making meaningful changes or additions to the SQLite, so   this article should be read closely by anyone aspiring  to hack the source code.}HEADING 2 BackgroundPARAGRAPH {  It is important to understand that SQL is a programming language.  SQL is a perculiar programming language in that it  describes <u>what</u> the programmer wants to compute not <u>how</u>  to compute it as most other programming languages do.  But perculiar or not, SQL is still just a programming language.}PARAGRAPH {  It is very helpful to think of each SQL statement as a separate  program.  An important job of the SQL database engine is to translate each  SQL statement from its descriptive form that specifies what the  information is desired (the <u>what</u>)   into a procedural form that specifies how to go  about acquiring the desired information (the <u>how</u>).  The task of translating the <u>what</u> into a   <u>how</u> is assigned to the query optimizer.}PARAGRAPH {  The beauty of SQL comes from the fact that the optimizer frees the programmer  from having to worry over the details of <u>how</u>.  The programmer  only has to specify the <u>what</u> and then leave the optimizer  to deal with all of the minutae of implementing the  <u>how</u>.  Thus the programmer is able to think and work at a  much higher level and leave the optimizer to stress over the low-level  work.}HEADING 2 {Database Layout}PARAGRAPH {  An SQLite database consists of one or more "b-trees".  Each b-tree contains zero or more "rows".   A single row contains a "key" and some "data".  In general, both the key and the data are arbitrary binary  data of any length.  The keys must all be unique within a single b-tree.  Rows are stored in order of increasing key values - each  b-tree has a comparision functions for keys that determines  this order.}PARAGRAPH {  In SQLite, each SQL table is stored as a b-tree where the  key is a 64-bit integer and the data is the content of the  table row.  The 64-bit integer key is the ROWID.  And, of course,  if the table has an INTEGER PRIMARY KEY, then that integer is just  an alias for the ROWID.}PARAGRAPH {  Consider the following block of SQL code:}CODE {  CREATE TABLE ex1(     id INTEGER PRIMARY KEY,     x  VARCHAR(30),     y  INTEGER  );  INSERT INTO ex1 VALUES(NULL,'abc',12345);  INSERT INTO ex1 VALUES(NULL,456,'def');  INSERT INTO ex1 VALUES(100,'hello','world');  INSERT INTO ex1 VALUES(-5,'abc','xyz');  INSERT INTO ex1 VALUES(54321,NULL,987);}PARAGRAPH {  This code generates a new b-tree (named "ex1") containing 5 rows.  This table can be visualized as follows:}IMAGE table-ex1b2.gifPARAGRAPH {  Note that the key for each row if the b-tree is the INTEGER PRIMARY KEY  for that row.  (Remember that the INTEGER PRIMARY KEY is just an alias  for the ROWID.)  The other fields of the table form the data for each  entry in the b-tree.  Note also that the b-tree entries are in ROWID order  which is different from the order that they were originally inserted.}PARAGRAPH {  Now consider the following SQL query:}CODE {  SELECT y FROM ex1 WHERE x=456;}PARAGRAPH {  When the SQLite parser and query optimizer are handed this query, they  have to translate it into a procedure that will find the desired result.  In this case, they do what is call a "full table scan".  They start  at the beginning of the b-tree that contains the table and visit each  row.  Within each row, the value of the "x" column is tested and when it  is found to match 456, the value of the "y" column is output.  We can represent this procedure graphically as follows:}IMAGE fullscanb.gifPARAGRAPH {  A full table scan is the access method of last resort.  It will always  work.  But if the table contains millions of rows and you are only looking  a single one, it might take a very long time to find the particular row  you are interested in.  In particular, the time needed to access a single row of the table is  proportional to the total number of rows in the table.  So a big part of the job of the optimizer is to try to find ways to   satisfy the query without doing a full table scan.}PARAGRAPH {  The usual way to avoid doing a full table scan is use a binary search  to find the particular row or rows of interest in the table.  Consider the next query which searches on rowid instead of x:}CODE {  SELECT y FROM ex1 WHERE rowid=2;}PARAGRAPH {  In the previous query, we could not use a binary search for x because  the values of x were not ordered.  But the rowid values are ordered.  So instead of having to visit every row of the b-tree looking for one  that has a rowid value of 2, we can do a binary search for that particular  row and output its corresponding y value.  We show this graphically  as follows:}IMAGE direct1b.gifPARAGRAPH {  When doing a binary search, we only have to look at a number of  rows with is proportional to the logorithm of the number of entries  in the table.  For a table with just 5 entires as in the example above,  the difference between a full table scan and a binary search is  negligible.  In fact, the full table scan might be faster.  But in  a database that has 5 million rows, a binary search will be able to  find the desired row in only about 23 tries, whereas the full table  scan will need to look at all 5 million rows.  So the binary search  is about 200,000 times faster in that case.}PARAGRAPH {  A 200,000-fold speed improvement is huge.  So we always want to do  a binary search rather than a full table scan when we can.}PARAGRAPH {  The problem with a binary search is that the it only works if the  fields you are search for are in sorted order.  So we can do a binary  search when looking up the rowid because the rows of the table are  sorted by rowid.  But we cannot use a binary search when looking up  x because the values in the x column are in no particular order.}PARAGRAPH {  The way to work around this problem and to permit binary searching on  fields like x is to provide an index.  An index is another b-tree.  But in the index b-tree the key is not the rowid but rather the field  or fields being indexed followed by the rowid.  The data in an index b-tree is empty - it is not needed or used.  The following diagram shows an index on the x field of our example table:}IMAGE index-ex1-x-b.gifPARAGRAPH {  An important point to note in the index are that they keys of the  b-tree are in sorted order.  (Recall that NULL values in SQLite sort  first, followed by numeric values in numerical order, then strings, and  finally BLOBs.)  This is the property that will allow use to do a  binary search for the field x.  The rowid is also included in every  key for two reasons.  First, by including the rowid we guarantee that  every key will be unique.  And second, the rowid will be used to look  up the actual table entry after doing the binary search.  Finally, note  that the data portion of the index b-tree serves no purpose and is thus  kept empty to save space in the disk file.}PARAGRAPH {  Remember what the original query example looked like:}CODE {  SELECT y FROM ex1 WHERE x=456;}PARAGRAPH {  The first time this query was encountered we had to do a full table  scan.  But now that we have an index on x, we can do a binary search  on that index for the entry where x==456.  Then from that entry we  can find the rowid value and use the rowid to look up the corresponding  entry in the original table.  From the entry in the original table,  we can find the value y and return it as our result.  The following  diagram shows this process graphically:}IMAGE indirect1b1.gifPARAGRAPH {  With the index, we are able to look up an entry based on the value of  x after visiting only a logorithmic number of b-tree entries.  Unlike  the case where we were searching using rowid, we have to do two binary  searches for each output row.  But for a 5-million row table, that is  still only 46 searches instead of 5 million for a 100,000-fold speedup.}HEADING 3 {Parsing The WHERE Clause}# parsing the where clause# rowid lookup# index lookup# index lookup without the table# how an index is chosen# joins# join reordering# order by using an index# group by using an index# OR -> IN optimization# Bitmap indices# LIKE and GLOB optimization# subquery flattening# MIN and MAX optimizations

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩中文欧美在线| 在线中文字幕一区二区| www.av精品| 欧美日韩国产高清一区| 国产亚洲欧美一级| 亚洲国产综合视频在线观看| 久久99国产精品成人| 91在线精品一区二区| 日韩一区二区免费在线电影| 国产精品美女一区二区| 美女一区二区在线观看| 91蝌蚪porny九色| 久久精品在线观看| 三级久久三级久久| 日本精品裸体写真集在线观看| 51午夜精品国产| 亚洲免费看黄网站| 成人丝袜18视频在线观看| 91精品国产一区二区人妖| 国产精品久久三| 国产在线视频一区二区三区| 色综合久久中文综合久久牛| 久久这里只精品最新地址| 亚洲成人高清在线| 欧美熟乱第一页| 一区二区三区国产豹纹内裤在线 | a美女胸又www黄视频久久| 欧美一级xxx| 日本中文一区二区三区| 欧美日韩1区2区| 亚洲成人中文在线| 欧美精品一级二级| 亚洲mv在线观看| 欧美人体做爰大胆视频| 婷婷久久综合九色综合绿巨人| 欧美亚洲一区二区三区四区| 亚洲综合小说图片| 欧美在线三级电影| 亚洲成人精品一区| 欧美丰满嫩嫩电影| 奇米影视7777精品一区二区| 欧美一区三区四区| 蜜臀av一区二区在线观看| 精品人在线二区三区| 国模一区二区三区白浆| 国产亚洲欧美中文| 99国产精品久久久久| 一区二区三区四区亚洲| 欧美人与禽zozo性伦| 精久久久久久久久久久| 国产欧美日韩在线看| 色综合久久久久网| 五月天婷婷综合| 久久久久久久久久久99999| 国产精品 欧美精品| 亚洲激情男女视频| 91精品在线观看入口| 国产精品自拍av| 一区二区视频在线| 日韩一区二区影院| 粉嫩高潮美女一区二区三区| 亚洲精品一二三四区| 在线不卡一区二区| 国产精品一区二区视频| 亚洲伊人色欲综合网| 欧美成人a视频| 99久久综合国产精品| 日韩主播视频在线| 欧美国产日韩一二三区| 精品1区2区3区| 国产精品18久久久久久久网站| 亚洲精品乱码久久久久久日本蜜臀 | 色狠狠综合天天综合综合| 午夜影院久久久| 国产亚洲精久久久久久| 欧美日韩精品一区二区天天拍小说| 蜜桃av噜噜一区二区三区小说| 国产精品久久看| 日韩一区二区在线看| 99国产欧美久久久精品| 日本不卡一区二区| 亚洲欧美一区二区三区极速播放| 欧美一级欧美三级在线观看| 波多野结衣亚洲一区| 美女一区二区久久| 一区二区三区精品视频| 国产精品久久久久一区| 精品国产99国产精品| 欧美日韩在线一区二区| eeuss鲁片一区二区三区在线观看| 久久国内精品自在自线400部| 亚洲女与黑人做爰| 欧美国产日产图区| xnxx国产精品| 日韩欧美电影在线| 欧美精品 日韩| 91高清在线观看| 99久久精品免费| 国产成人免费视频精品含羞草妖精| 午夜不卡av在线| 亚洲一二三四在线观看| 亚洲精品一二三四区| 国产精品成人免费| 国产精品高清亚洲| 欧美激情综合五月色丁香小说| 日韩欧美国产wwwww| 欧美日韩国产另类一区| 欧美日韩一区视频| 精品国产免费人成在线观看| 日韩一级免费一区| 91精品国产综合久久香蕉麻豆| 欧美特级限制片免费在线观看| 91麻豆国产自产在线观看| 成人app在线观看| 成人免费视频免费观看| 国产成人av电影免费在线观看| 国产资源在线一区| 国产一区二区调教| 国产黄人亚洲片| 成人午夜激情视频| 99re热这里只有精品免费视频| 99精品欧美一区二区蜜桃免费| 成人三级伦理片| 99精品1区2区| 欧美日韩一区 二区 三区 久久精品| 色哟哟在线观看一区二区三区| 91性感美女视频| 欧美性大战xxxxx久久久| 欧美日韩不卡一区| 日韩午夜精品电影| 日本一区二区三区dvd视频在线| 国产精品水嫩水嫩| 亚洲激情在线播放| 日韩国产欧美视频| 国产一区不卡视频| 不卡的av中国片| 欧美午夜精品理论片a级按摩| 欧美日韩国产bt| 久久久久亚洲综合| 国产精品美女久久久久久| 亚洲日本一区二区三区| 五月天视频一区| 国产精品1区2区| 欧美怡红院视频| 日韩女优视频免费观看| 国产精品视频第一区| 亚洲综合免费观看高清完整版| 蜜臀av性久久久久蜜臀aⅴ| 国产乱子伦一区二区三区国色天香| 成人丝袜高跟foot| 91精品国产一区二区| 久久一留热品黄| 综合久久久久综合| 久久国产福利国产秒拍| 成人app网站| 日韩精品一区二区三区在线 | 91亚洲精品乱码久久久久久蜜桃| 欧美影片第一页| 日本一区二区综合亚洲| 亚洲超碰97人人做人人爱| 国产成人免费在线观看不卡| 91国偷自产一区二区三区成为亚洲经典| 91精品国产综合久久婷婷香蕉| 日本一区二区高清| 热久久国产精品| 91高清在线观看| 国产日韩欧美高清| 日韩成人av影视| 97久久精品人人澡人人爽| 日韩一区二区在线免费观看| 亚洲综合偷拍欧美一区色| 国产v日产∨综合v精品视频| 欧美一区二区三区视频在线观看| 国产精品久久久久aaaa| 精品一区二区三区免费视频| 欧美三级日本三级少妇99| 国产精品国产三级国产有无不卡 | 久久日韩精品一区二区五区| 夜夜嗨av一区二区三区四季av| 国产成人精品影院| 欧美一级片免费看| 色香蕉久久蜜桃| 中文字幕国产精品一区二区| 九九精品一区二区| 制服丝袜亚洲色图| 午夜私人影院久久久久| 日本道在线观看一区二区| 国产精品人人做人人爽人人添| 黄色日韩网站视频| 精品捆绑美女sm三区| 三级欧美在线一区| 6080午夜不卡| 免费人成在线不卡| 欧美一区二区在线播放| 午夜精品成人在线视频| 欧美视频一区在线| 亚洲va欧美va人人爽午夜| 欧美在线不卡视频| 亚洲一区二区三区中文字幕 | 色婷婷av一区二区三区大白胸 |