aboutsummaryrefslogtreecommitdiff
path: root/src/where.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/where.c')
-rw-r--r--src/where.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/where.c b/src/where.c
index 1d8ba88ba..79ec7f690 100644
--- a/src/where.c
+++ b/src/where.c
@@ -5353,6 +5353,15 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
pWInfo->nRowOut = pFrom->nRow;
+ /* TUNING: Assume that a DISTINCT clause on a subquery reduces
+ ** the output size by a factor of 8 (LogEst -30)
+ */
+ if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0
+ && pWInfo->nRowOut>30
+ ){
+ pWInfo->nRowOut -= 30;
+ }
+
/* Free temporary memory and return success */
sqlite3StackFreeNN(pParse->db, pSpace);
return SQLITE_OK;