Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Side by Side Diff: third_party/sqlite/src/test/where3.test

Issue 5626002: Update sqlite to 3.7.3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/third_party/sqlite/src
Patch Set: Remove misc change. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/test/where2.test ('k') | third_party/sqlite/src/test/where6.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2006 January 31 1 # 2006 January 31
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx 192 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
193 WHERE apk=cx AND bpk=ax 193 WHERE apk=cx AND bpk=ax
194 } 194 }
195 } {tC {} tA * tB * tD *} 195 } {tC {} tA * tB * tD *}
196 do_test where3-2.5 { 196 do_test where3-2.5 {
197 queryplan { 197 queryplan {
198 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx 198 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
199 WHERE cpk=ax AND bpk=cx 199 WHERE cpk=ax AND bpk=cx
200 } 200 }
201 } {tA {} tC * tB * tD *} 201 } {tA {} tC * tB * tD *}
202 do_test where3-2.5 { 202 do_test where3-2.6 {
203 queryplan { 203 queryplan {
204 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx 204 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
205 WHERE bpk=cx AND apk=bx 205 WHERE bpk=cx AND apk=bx
206 } 206 }
207 } {tC {} tB * tA * tD *} 207 } {tC {} tB * tA * tD *}
208 do_test where3-2.6 { 208 do_test where3-2.7 {
209 queryplan { 209 queryplan {
210 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx 210 SELECT * FROM tA, tB, tC LEFT JOIN tD ON dpk=cx
211 WHERE cpk=bx AND apk=cx 211 WHERE cpk=bx AND apk=cx
212 } 212 }
213 } {tB {} tC * tA * tD *} 213 } {tB {} tC * tA * tD *}
214 214
215 # Ticket [13f033c865f878953]
216 # If the outer loop must be a full table scan, do not let ANALYZE trick
217 # the planner into use a table for the outer loop that might be indexable
218 # if held until an inner loop.
219 #
220 do_test where3-3.0 {
221 execsql {
222 CREATE TABLE t301(a INTEGER PRIMARY KEY,b,c);
223 CREATE INDEX t301c ON t301(c);
224 INSERT INTO t301 VALUES(1,2,3);
225 CREATE TABLE t302(x, y);
226 ANALYZE;
227 explain query plan
228 SELECT * FROM t302, t301 WHERE t302.x=5 AND t301.a=t302.y;
229 }
230 } {0 0 {TABLE t302} 1 1 {TABLE t301 USING PRIMARY KEY}}
231 do_test where3-3.1 {
232 execsql {
233 explain query plan
234 SELECT * FROM t301, t302 WHERE t302.x=5 AND t301.a=t302.y;
235 }
236 } {0 1 {TABLE t302} 1 0 {TABLE t301 USING PRIMARY KEY}}
237
238 # Verify that when there are multiple tables in a join which must be
239 # full table scans that the query planner attempts put the table with
240 # the fewest number of output rows as the outer loop.
241 #
242 do_test where3-4.0 {
243 execsql {
244 CREATE TABLE t400(a INTEGER PRIMARY KEY, b, c);
245 CREATE TABLE t401(p INTEGER PRIMARY KEY, q, r);
246 CREATE TABLE t402(x INTEGER PRIMARY KEY, y, z);
247 EXPLAIN QUERY PLAN
248 SELECT * FROM t400, t401, t402 WHERE t402.z GLOB 'abc*';
249 }
250 } {0 2 {TABLE t402} 1 0 {TABLE t400} 2 1 {TABLE t401}}
251 do_test where3-4.1 {
252 execsql {
253 EXPLAIN QUERY PLAN
254 SELECT * FROM t400, t401, t402 WHERE t401.r GLOB 'abc*';
255 }
256 } {0 1 {TABLE t401} 1 0 {TABLE t400} 2 2 {TABLE t402}}
257 do_test where3-4.2 {
258 execsql {
259 EXPLAIN QUERY PLAN
260 SELECT * FROM t400, t401, t402 WHERE t400.c GLOB 'abc*';
261 }
262 } {0 0 {TABLE t400} 1 1 {TABLE t401} 2 2 {TABLE t402}}
263
264 # Verify that a performance regression encountered by firefox
265 # has been fixed.
266 #
267 do_test where3-5.0 {
268 execsql {
269 CREATE TABLE aaa (id INTEGER PRIMARY KEY, type INTEGER,
270 fk INTEGER DEFAULT NULL, parent INTEGER,
271 position INTEGER, title LONGVARCHAR,
272 keyword_id INTEGER, folder_type TEXT,
273 dateAdded INTEGER, lastModified INTEGER);
274 CREATE INDEX aaa_111 ON aaa (fk, type);
275 CREATE INDEX aaa_222 ON aaa (parent, position);
276 CREATE INDEX aaa_333 ON aaa (fk, lastModified);
277 CREATE TABLE bbb (id INTEGER PRIMARY KEY, type INTEGER,
278 fk INTEGER DEFAULT NULL, parent INTEGER,
279 position INTEGER, title LONGVARCHAR,
280 keyword_id INTEGER, folder_type TEXT,
281 dateAdded INTEGER, lastModified INTEGER);
282 CREATE INDEX bbb_111 ON bbb (fk, type);
283 CREATE INDEX bbb_222 ON bbb (parent, position);
284 CREATE INDEX bbb_333 ON bbb (fk, lastModified);
285 }
286
287 execsql {
288 EXPLAIN QUERY PLAN
289 SELECT bbb.title AS tag_title
290 FROM aaa JOIN bbb ON bbb.id = aaa.parent
291 WHERE aaa.fk = 'constant'
292 AND LENGTH(bbb.title) > 0
293 AND bbb.parent = 4
294 ORDER BY bbb.title COLLATE NOCASE ASC;
295 }
296 } {0 0 {TABLE aaa WITH INDEX aaa_333} 1 1 {TABLE bbb USING PRIMARY KEY}}
297 do_test where3-5.1 {
298 execsql {
299 EXPLAIN QUERY PLAN
300 SELECT bbb.title AS tag_title
301 FROM aaa JOIN aaa AS bbb ON bbb.id = aaa.parent
302 WHERE aaa.fk = 'constant'
303 AND LENGTH(bbb.title) > 0
304 AND bbb.parent = 4
305 ORDER BY bbb.title COLLATE NOCASE ASC;
306 }
307 } {0 0 {TABLE aaa WITH INDEX aaa_333} 1 1 {TABLE aaa AS bbb USING PRIMARY KEY}}
308 do_test where3-5.2 {
309 execsql {
310 EXPLAIN QUERY PLAN
311 SELECT bbb.title AS tag_title
312 FROM bbb JOIN aaa ON bbb.id = aaa.parent
313 WHERE aaa.fk = 'constant'
314 AND LENGTH(bbb.title) > 0
315 AND bbb.parent = 4
316 ORDER BY bbb.title COLLATE NOCASE ASC;
317 }
318 } {0 1 {TABLE aaa WITH INDEX aaa_333} 1 0 {TABLE bbb USING PRIMARY KEY}}
319 do_test where3-5.3 {
320 execsql {
321 EXPLAIN QUERY PLAN
322 SELECT bbb.title AS tag_title
323 FROM aaa AS bbb JOIN aaa ON bbb.id = aaa.parent
324 WHERE aaa.fk = 'constant'
325 AND LENGTH(bbb.title) > 0
326 AND bbb.parent = 4
327 ORDER BY bbb.title COLLATE NOCASE ASC;
328 }
329 } {0 1 {TABLE aaa WITH INDEX aaa_333} 1 0 {TABLE aaa AS bbb USING PRIMARY KEY}}
330
215 331
216 finish_test 332 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/where2.test ('k') | third_party/sqlite/src/test/where6.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698