Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch analyze-idx Excluding Merge-Ins
This is equivalent to a diff from a84f7711 to 365896cb
2011-04-01
| ||
14:26 | Merge the ANALYZE-index enhancement into trunk. (check-in: 7e237aea user: drh tags: trunk) | |
14:04 | Test cases for ANALYZE-index. (Closed-Leaf check-in: 365896cb user: drh tags: analyze-idx) | |
01:38 | Fix a compiler warning and an unreachable branch. Restore 100% branch test coverage. (check-in: 4dc148bb user: drh tags: trunk) | |
2011-03-31
| ||
02:03 | Change the ANALYZE command so that it will accept an index name as its argument and only reanalyze that one index. A quick smoke-test works. Need to study the implications to the query planner and test corner cases. (check-in: c8f9edd9 user: drh tags: analyze-idx) | |
2011-03-30
| ||
19:08 | Further tests for os_unix.c. (check-in: a84f7711 user: dan tags: trunk) | |
14:54 | Do not generate sqlite_stat1 entries for empty tables when running ANALYZE. Ticket [83ea97620bd31016451] (check-in: 3a27af5b user: drh tags: trunk) | |
Changes to src/analyze.c.
︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | + - + | ** with the named table are deleted. If zWhere==0, then code is generated ** to delete all stat table entries. */ static void openStatTable( Parse *pParse, /* Parsing context */ int iDb, /* The database we are looking in */ int iStatCur, /* Open the sqlite_stat1 table on this cursor */ const char *zWhere, /* Delete entries for this table or index */ |
︙ | |||
75 76 77 78 79 80 81 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + | /* The table already exists. If zWhere is not NULL, delete all entries ** associated with the table zWhere. If zWhere is NULL, delete the ** entire contents of the table. */ aRoot[i] = pStat->tnum; sqlite3TableLock(pParse, iDb, aRoot[i], 1, zTab); if( zWhere ){ sqlite3NestedParse(pParse, |
︙ | |||
99 100 101 102 103 104 105 106 107 108 109 110 111 112 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | + | /* ** Generate code to do an analysis of all indices associated with ** a single table. */ static void analyzeOneTable( Parse *pParse, /* Parser context */ Table *pTab, /* Table whose indices are to be analyzed */ Index *pOnlyIdx, /* If not NULL, only analyze this one index */ int iStatCur, /* Index of VdbeCursor that writes the sqlite_stat1 table */ int iMem /* Available memory locations begin here */ ){ sqlite3 *db = pParse->db; /* Database handle */ Index *pIdx; /* An index to being analyzed */ int iIdxCur; /* Cursor open on index being analyzed */ Vdbe *v; /* The virtual machine being built up */ |
︙ | |||
156 157 158 159 160 161 162 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - - + + + + + | /* Establish a read-lock on the table at the shared-cache level. */ sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); iIdxCur = pParse->nTab++; sqlite3VdbeAddOp4(v, OP_String8, 0, regTabname, 0, pTab->zName, 0); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
︙ | |||
379 380 381 382 383 384 385 | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | - + - + - + + - + + - - + + + + + | HashElem *k; int iStatCur; int iMem; sqlite3BeginWriteOperation(pParse, 0, iDb); iStatCur = pParse->nTab; pParse->nTab += 2; |
︙ | |||
425 426 427 428 429 430 431 432 433 434 435 436 437 438 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | + | */ void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ sqlite3 *db = pParse->db; int iDb; int i; char *z, *zDb; Table *pTab; Index *pIdx; Token *pTableName; /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ return; |
︙ | |||
449 450 451 452 453 454 455 | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | + + - + - - - + + + + - + - - - + + | /* Form 2: Analyze the database or table named */ iDb = sqlite3FindDb(db, pName1); if( iDb>=0 ){ analyzeDatabase(pParse, iDb); }else{ z = sqlite3NameFromToken(db, pName1); if( z ){ if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){ analyzeTable(pParse, pIdx->pTable, pIdx); |
︙ |
Added test/analyze7.test.