/ Check-in [d6afd98d]
Login

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

Overview
Comment:Move a branch condition in analyze.c inside an #ifdef SQLITE_ENABLE_STAT4 block.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d6afd98de3ee8b714dfd6477ead955096f623972
User & Date: dan 2017-02-22 19:41:16
Context
2017-02-23
16:30
Save a few bytes and a few cycles by setting Vdbe.expmask to zero for statements prepared using legacy interface sqlite3_prepare(). check-in: a8fd7052 user: dan tags: trunk
2017-02-22
19:49
Merge integrity_check and other improvements from trunk. check-in: fe073905 user: drh tags: auto-analyze
19:41
Move a branch condition in analyze.c inside an #ifdef SQLITE_ENABLE_STAT4 block. check-in: d6afd98d user: dan tags: trunk
19:27
Improve the performance of ANALYZE when SQLITE_ENABLE_STAT4 is defined. check-in: 737a8244 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to src/analyze.c.

548
549
550
551
552
553
554



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
** Copy the contents of sample *pNew into the p->a[] array. If necessary,
** remove the least desirable sample from p->a[] to make room.
*/
static void sampleInsert(Stat4Accum *p, Stat4Sample *pNew, int nEqZero){
  Stat4Sample *pSample = 0;
  int i;




  /* Stat4Accum.nMaxEqZero is set to the maximum number of leading 0
  ** values in the anEq[] array of any sample in Stat4Accum.a[]. In
  ** other words, if nMaxEqZero is n, then it is guaranteed that there
  ** are no samples with Stat4Sample.anEq[m]==0 for (m>=n). */
  assert( IsStat4 || nEqZero==0 );
  if( nEqZero>p->nMaxEqZero ){
    p->nMaxEqZero = nEqZero;
  }

#ifdef SQLITE_ENABLE_STAT4
  if( pNew->isPSample==0 ){
    Stat4Sample *pUpgrade = 0;
    assert( pNew->anEq[pNew->iCol]>0 );

    /* This sample is being added because the prefix that ends in column 
    ** iCol occurs many times in the table. However, if we have already
    ** added a sample that shares this prefix, there is no need to add







>
>
>




<



<
<







548
549
550
551
552
553
554
555
556
557
558
559
560
561

562
563
564


565
566
567
568
569
570
571
** Copy the contents of sample *pNew into the p->a[] array. If necessary,
** remove the least desirable sample from p->a[] to make room.
*/
static void sampleInsert(Stat4Accum *p, Stat4Sample *pNew, int nEqZero){
  Stat4Sample *pSample = 0;
  int i;

  assert( IsStat4 || nEqZero==0 );

#ifdef SQLITE_ENABLE_STAT4
  /* Stat4Accum.nMaxEqZero is set to the maximum number of leading 0
  ** values in the anEq[] array of any sample in Stat4Accum.a[]. In
  ** other words, if nMaxEqZero is n, then it is guaranteed that there
  ** are no samples with Stat4Sample.anEq[m]==0 for (m>=n). */

  if( nEqZero>p->nMaxEqZero ){
    p->nMaxEqZero = nEqZero;
  }


  if( pNew->isPSample==0 ){
    Stat4Sample *pUpgrade = 0;
    assert( pNew->anEq[pNew->iCol]>0 );

    /* This sample is being added because the prefix that ends in column 
    ** iCol occurs many times in the table. However, if we have already
    ** added a sample that shares this prefix, there is no need to add