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

@ -1,5 +1,5 @@
C Fix\sdocumentation\stypo:\s\sThe\sname\sof\sthe\scompeting\sdatabase\sengine\sis\n"Firebird",\snot\s"Firefox".\s(CVS\s3185)
D 2006-05-11T13:33:15
C Adjust\sthe\sdefault\sweights\son\sindices\sso\sthat\san\sindex\sthat\smatches\smore\nterms\sof\sthe\swhere\sclause\swins\s(by\sdefault)\sover\sone\sthat\smatches\sfewer.\nTicket\s#1808.\s(CVS\s3186)
D 2006-05-11T23:14:59
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -36,7 +36,7 @@ F src/attach.c 765217a681eb0fb68f95f372604d4fa4594a503f
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c ed343b3dbcbc7da9ac481ef2b98c4239fe6d9629
F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d
F src/build.c be0629119df8c1e09050a8fcbf182112f00e3b14
F src/build.c eefefdc88cb342bc0f7cb41ccdf3930739ab50e9
F src/callback.c d8c5ab1cd6f3b7182b2ee63bf53f1b69c0f74306
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e
@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P b16541ba5e6a9514f9f317888117c68b6818f9cb
R b8034471ef61410f1e2f843f0d9f2cab
P 8be6a39d7108839b0fb298a2d536d68ebca86d66
R ca37ef1e70cde1be97fa0ecd09fa17b0
U drh
Z 25c2c7a2cf76120bd0d5c90ff2924a7f
Z 6c8fcc37f137fc75f72b520deac05cb8

View File

@ -1 +1 @@
8be6a39d7108839b0fb298a2d536d68ebca86d66
249b579f83b2922e3e03037186a9402af951e6d1

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;