Differences From Artifact [5eddbd47d8]:
- File src/db.c — part of check-in [251fd001a8] at 2010-04-02 19:28:00 on branch trunk — Add additional markups to show inefficient queries when running in TH3_DEBUG mode. (user: drh size: 45040)
To Artifact [8db5889b94]:
- File src/db.c — part of check-in [b84917dbf8] at 2010-04-07 20:02:14 on branch trunk — Update SQLite to a version that includes automatic index support. When compiled with FOSSIL_DEBUG, issue warnings if any automatic index is ever used. (user: drh size: 45201)
| ︙ | ︙ | |||
281 282 283 284 285 286 287 |
}
/*
** Print warnings if a query is inefficient.
*/
static void db_stats(Stmt *pStmt){
#ifdef FOSSIL_DEBUG
| | | > > > | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
}
/*
** Print warnings if a query is inefficient.
*/
static void db_stats(Stmt *pStmt){
#ifdef FOSSIL_DEBUG
int c1, c2, c3;
const char *zSql = sqlite3_sql(pStmt->pStmt);
if( zSql==0 ) return;
c1 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, 1);
c2 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, 1);
c3 = sqlite3_stmt_status(pStmt->pStmt, SQLITE_STMTSTATUS_SORT, 1);
if( c1>pStmt->nStep*4 && strstr(zSql,"/*scan*/")==0 ){
fossil_warning("%d scan steps for %d rows in [%s]", c1, pStmt->nStep, zSql);
}else if( c2 ){
fossil_warning("%d automatic index rows in [%s]", c2, zSql);
}else if( c3 && strstr(zSql,"/*sort*/")==0 && strstr(zSql,"/*scan*/")==0 ){
fossil_warning("sort w/o index in [%s]", zSql);
}
pStmt->nStep = 0;
#endif
}
/*
|
| ︙ | ︙ |