Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 242959 Details for
Bug 332747
dev-db/sqlite-3.7.0: serious performance regression/corruption with media-sound/banshee
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Backported patch
sqlite-3.7.0-performance-regression-amalgamation.patch (text/plain), 3.71 KB, created by
corec
on 2010-08-14 16:04:44 UTC
(
hide
)
Description:
Backported patch
Filename:
MIME Type:
Creator:
corec
Created:
2010-08-14 16:04:44 UTC
Size:
3.71 KB
patch
obsolete
>diff --git a/sqlite3.c b/sqlite3.c >index 925c15a..bbb3ac0 100644 >--- a/sqlite3.c >+++ b/sqlite3.c >@@ -97323,6 +97323,8 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( > int bestJ = -1; /* The value of j */ > Bitmask m; /* Bitmask value for j or bestJ */ > int isOptimal; /* Iterator for optimal/non-optimal search */ >+ int nUnconstrained; /* Number tables without INDEXED BY */ >+ Bitmask notIndexed; /* Mask of tables that cannot use an index */ > > memset(&bestPlan, 0, sizeof(bestPlan)); > bestPlan.rCost = SQLITE_BIG_DBL; >@@ -97364,6 +97366,8 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( > ** algorithm may choose to use t2 for the outer loop, which is a much > ** costlier approach. > */ >+ nUnconstrained = 0; >+ notIndexed = 0; > for(isOptimal=(iFrom<nTabList-1); isOptimal>=0; isOptimal--){ > Bitmask mask; /* Mask of tables not yet ready */ > for(j=iFrom, pTabItem=&pTabList->a[j]; j<nTabList; j++, pTabItem++){ >@@ -97380,6 +97384,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( > } > mask = (isOptimal ? m : notReady); > pOrderBy = ((i==0 && ppOrderBy )?*ppOrderBy:0); >+ if( pTabItem->pIndex==0 ) nUnconstrained++; > > assert( pTabItem->pTab ); > #ifndef SQLITE_OMIT_VIRTUALTABLE >@@ -97393,9 +97398,43 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( > } > assert( isOptimal || (sCost.used¬Ready)==0 ); > >- if( (sCost.used¬Ready)==0 >- && (bestJ<0 || sCost.rCost<bestPlan.rCost >- || (sCost.rCost<=bestPlan.rCost && sCost.nRow<bestPlan.nRow)) >+ /* If an INDEXED BY clause is present, then the plan must use that >+ ** index if it uses any index at all */ >+ assert( pTabItem->pIndex==0 >+ || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 >+ || sCost.plan.u.pIdx==pTabItem->pIndex ); >+ >+ if( isOptimal && (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)==0 ){ >+ notIndexed |= m; >+ } >+ >+ /* Conditions under which this table becomes the best so far: >+ ** >+ ** (1) The table must not depend on other tables that have not >+ ** yet run. >+ ** >+ ** (2) A full-table-scan plan cannot supercede another plan unless >+ ** it is an "optimal" plan as defined above. >+ ** >+ ** (3) All tables have an INDEXED BY clause or this table lacks an >+ ** INDEXED BY clause or this table uses the specific >+ ** index specified by its INDEXED BY clause. This rule ensures >+ ** that a best-so-far is always selected even if an impossible >+ ** combination of INDEXED BY clauses are given. The error >+ ** will be detected and relayed back to the application later. >+ ** The NEVER() comes about because rule (2) above prevents >+ ** An indexable full-table-scan from reaching rule (3). >+ ** >+ ** (4) The plan cost must be lower than prior plans or else the >+ ** cost must be the same and the number of rows must be lower. >+ */ >+ if( (sCost.used¬Ready)==0 /* (1) */ >+ && (bestJ<0 || (notIndexed&m)!=0 /* (2) */ >+ || (sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0) >+ && (nUnconstrained==0 || pTabItem->pIndex==0 /* (3) */ >+ || NEVER((sCost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0)) >+ && (bestJ<0 || sCost.rCost<bestPlan.rCost /* (4) */ >+ || (sCost.rCost<=bestPlan.rCost && sCost.nRow<bestPlan.nRow)) > ){ > WHERETRACE(("... best so far with cost=%g and nRow=%g\n", > sCost.rCost, sCost.nRow));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 332747
:
242957
| 242959 |
242961
|
242971