1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-07 20:22:20 +03:00

Adjust the default weights on indices so that an index that matches more

terms of the where clause wins (by default) over one that matches fewer.
Ticket #1808. (CVS 3186)

FossilOrigin-Name: 249b579f83b2922e3e03037186a9402af951e6d1
This commit is contained in:
drh
2006-05-11 23:14:59 +00:00
parent 2886cc0783
commit db5138885b
3 changed files with 14 additions and 10 deletions

View File

@@ -22,7 +22,7 @@
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.393 2006/03/24 03:36:26 drh Exp $
** $Id: build.c,v 1.394 2006/05/11 23:14:59 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2638,8 +2638,12 @@ void sqlite3DefaultRowEst(Index *pIdx){
int i;
assert( a!=0 );
a[0] = 1000000;
for(i=pIdx->nColumn; i>=1; i--){
a[i] = 10;
for(i=pIdx->nColumn; i>=5; i--){
a[i] = 5;
}
while( i>=1 ){
a[i] = 11 - i;
i--;
}
if( pIdx->onError!=OE_None ){
a[pIdx->nColumn] = 1;