/ Check-in [ee30fb35]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid O(N*N) behavior with very long lists of VALUES.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | many-VALUEs
Files: files | file ages | folders
SHA1: ee30fb35217f3429ee89aaad7c19f29710420e4c
User & Date: drh 2015-01-05 20:04:51
Context
2015-01-05
20:13
Enhance "INSERT INTO ... VALUES" so that the number of rows in the VALUES clause is not limited by SQLITE_LIMIT_COMPOUND_SELECT, and so that the stack depth is constant regardless of the number of rows in VALUES. check-in: e1c4a359 user: drh tags: trunk
20:04
Avoid O(N*N) behavior with very long lists of VALUES. Closed-Leaf check-in: ee30fb35 user: drh tags: many-VALUEs
19:16
Handle compound-select statements originating from VALUES clauses as a special case that does not use recursion. check-in: 9ce9e43a user: drh tags: many-VALUEs
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/select.c.

4111
4112
4113
4114
4115
4116
4117

4118

4119
4120
4121
4122
4123
4124
4125
....
4402
4403
4404
4405
4406
4407
4408

4409

4410
4411
4412
4413
4414
4415
4416
    return WRC_Abort;
  }
  if( NEVER(p->pSrc==0) || (selFlags & SF_Expanded)!=0 ){
    return WRC_Prune;
  }
  pTabList = p->pSrc;
  pEList = p->pEList;

  sqlite3WithPush(pParse, findRightmost(p)->pWith, 0);


  /* Make sure cursor numbers have been assigned to all entries in
  ** the FROM clause of the SELECT statement.
  */
  sqlite3SrcListAssignCursors(pParse, pTabList);

  /* Look up every table named in the FROM clause of the select.  If
................................................................................
  w.xExprCallback = exprWalkNoop;
  w.pParse = pParse;
  if( pParse->hasCompound ){
    w.xSelectCallback = convertCompoundSelectToSubquery;
    sqlite3WalkSelect(&w, pSelect);
  }
  w.xSelectCallback = selectExpander;

  w.xSelectCallback2 = selectPopWith;

  sqlite3WalkSelect(&w, pSelect);
}


#ifndef SQLITE_OMIT_SUBQUERY
/*
** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()







>
|
>







 







>
|
>







4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
....
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
    return WRC_Abort;
  }
  if( NEVER(p->pSrc==0) || (selFlags & SF_Expanded)!=0 ){
    return WRC_Prune;
  }
  pTabList = p->pSrc;
  pEList = p->pEList;
  if( pWalker->xSelectCallback2==selectPopWith ){
    sqlite3WithPush(pParse, findRightmost(p)->pWith, 0);
  }

  /* Make sure cursor numbers have been assigned to all entries in
  ** the FROM clause of the SELECT statement.
  */
  sqlite3SrcListAssignCursors(pParse, pTabList);

  /* Look up every table named in the FROM clause of the select.  If
................................................................................
  w.xExprCallback = exprWalkNoop;
  w.pParse = pParse;
  if( pParse->hasCompound ){
    w.xSelectCallback = convertCompoundSelectToSubquery;
    sqlite3WalkSelect(&w, pSelect);
  }
  w.xSelectCallback = selectExpander;
  if( (pSelect->selFlags & SF_AllValues)==0 ){
    w.xSelectCallback2 = selectPopWith;
  }
  sqlite3WalkSelect(&w, pSelect);
}


#ifndef SQLITE_OMIT_SUBQUERY
/*
** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo()