/ Check-in [97fdfc6b]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Remove an unnecessary column-cache flush. Add another test case to the speedtest1.c program to accentuate the benefit of not flushing the cache at that point.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | column-cache-debug
Files: files | file ages | folders
SHA1: 97fdfc6b79833011fc0c506fe5e0985c0fb1906c
User & Date: drh 2013-12-18 16:27:48
Context
2013-12-18
18:44
Remove an unnecessary column-cache flush operation. Add code to trace the column cache when compiled with SQLITE_DEBUG and using PRAGMA vdbe_addoptrace=ON. check-in: 58704ed1 user: drh tags: trunk
16:27
Remove an unnecessary column-cache flush. Add another test case to the speedtest1.c program to accentuate the benefit of not flushing the cache at that point. Closed-Leaf check-in: 97fdfc6b user: drh tags: column-cache-debug
15:11
Show changes to the column cache when PRAGMA vdbe_addoptrace=ON is set. check-in: 4c6a659c user: drh tags: column-cache-debug
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/select.c.

594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
    for(i=0; i<nColumn; i++){
      sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
    }
  }else if( eDest!=SRT_Exists ){
    /* If the destination is an EXISTS(...) expression, the actual
    ** values returned by the SELECT are not required.
    */
    sqlite3ExprCacheClear(pParse);
    sqlite3ExprCodeExprList(pParse, pEList, regResult,
                            (eDest==SRT_Output)?SQLITE_ECEL_DUP:0);
  }
  nColumn = nResultCol;

  /* If the DISTINCT keyword was present on the SELECT statement
  ** and this row has been seen before, then do not make this row







<







594
595
596
597
598
599
600

601
602
603
604
605
606
607
    for(i=0; i<nColumn; i++){
      sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
    }
  }else if( eDest!=SRT_Exists ){
    /* If the destination is an EXISTS(...) expression, the actual
    ** values returned by the SELECT are not required.
    */

    sqlite3ExprCodeExprList(pParse, pEList, regResult,
                            (eDest==SRT_Output)?SQLITE_ECEL_DUP:0);
  }
  nColumn = nResultCol;

  /* If the DISTINCT keyword was present on the SELECT statement
  ** and this row has been seen before, then do not make this row

Changes to test/speedtest1.c.

659
660
661
662
663
664
665







666

667
668
669
670
671
672
673
674
675


  speedtest1_begin_test(290, "Refill two %d-row tables using REPLACE", sz);
  speedtest1_exec("REPLACE INTO t2(a,b,c) SELECT a,b,c FROM t1");
  speedtest1_exec("REPLACE INTO t3(a,b,c) SELECT a,b,c FROM t1");
  speedtest1_end_test();










  n = sz/5;
  speedtest1_begin_test(300, "%d four-ways joins", n);
  speedtest1_exec("BEGIN");
  speedtest1_prepare(
    "SELECT t1.c FROM t1, t2, t3, t4\n"
    " WHERE t4.a BETWEEN ?1 AND ?2\n"
    "   AND t3.a=t4.b\n"
    "   AND t2.a=t3.b\n"
    "   AND t1.c=t2.c"







>
>
>
>
>
>
>

>

|







659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683


  speedtest1_begin_test(290, "Refill two %d-row tables using REPLACE", sz);
  speedtest1_exec("REPLACE INTO t2(a,b,c) SELECT a,b,c FROM t1");
  speedtest1_exec("REPLACE INTO t3(a,b,c) SELECT a,b,c FROM t1");
  speedtest1_end_test();

  speedtest1_begin_test(300, "Refill a %d-row table using (b&1)==(a&1)", sz);
  speedtest1_exec("DELETE FROM t2;");
  speedtest1_exec(
     "INSERT INTO t2(a,b,c) SELECT a,b,c FROM t1 WHERE (b&1)==(a&1);"
     "INSERT INTO t2(a,b,c) SELECT a,b,c FROM t1 WHERE (b&1)<>(a&1);"
  );
  speedtest1_end_test();


  n = sz/5;
  speedtest1_begin_test(310, "%d four-ways joins", n);
  speedtest1_exec("BEGIN");
  speedtest1_prepare(
    "SELECT t1.c FROM t1, t2, t3, t4\n"
    " WHERE t4.a BETWEEN ?1 AND ?2\n"
    "   AND t3.a=t4.b\n"
    "   AND t2.a=t3.b\n"
    "   AND t1.c=t2.c"