/ Check-in [bd65b180]
Login

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

Overview
Comment:Use the cache with loading a large table in select2-2.0. (CVS 2272)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bd65b1805c116a9073a01164d77e2bfd4ab3b447
User & Date: drh 2005-01-24 12:46:14
Context
2005-01-24
13:03
More test cases to do with invalidating precompiled statements. (CVS 2273) check-in: b243681a user: danielk1977 tags: trunk
12:46
Use the cache with loading a large table in select2-2.0. (CVS 2272) check-in: bd65b180 user: drh tags: trunk
10:25
Modifications and bugfixes so that the test suite passes with the TCL statement cache turned on. (CVS 2271) check-in: d5233e07 user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/select2.test.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
52
53
54
55
56
57
58
59


60

61

62
63

















64
65
66


67






68
69
70
71
72
73
74
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: select2.test,v 1.22 2004/05/28 11:37:29 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a table with some data
#
execsql {CREATE TABLE tbl1(f1 int, f2 int)}
................................................................................
    db eval $sql2 d2 {
      lappend r $d2(f2)
    }
  }
  set r
} {4: 2 3 4}

# Create a largish table


#

do_test select2-2.0 {

  execsql {CREATE TABLE tbl2(f1 int, f2 int, f3 int); BEGIN;}
  for {set i 1} {$i<=30000} {incr i} {

















    execsql "INSERT INTO tbl2 VALUES($i,[expr {$i*2}],[expr {$i*3}])"
  }
  execsql {COMMIT}


} {}







do_test select2-2.1 {
  execsql {SELECT count(*) FROM tbl2}
} {30000}
do_test select2-2.2 {
  execsql {SELECT count(*) FROM tbl2 WHERE f2>1000}
} {29500}







|







 







|
>
>

>
|
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>

>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing the SELECT statement.
#
# $Id: select2.test,v 1.23 2005/01/24 12:46:14 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Create a table with some data
#
execsql {CREATE TABLE tbl1(f1 int, f2 int)}
................................................................................
    db eval $sql2 d2 {
      lappend r $d2(f2)
    }
  }
  set r
} {4: 2 3 4}

# Create a largish table. Do this twice, once using the TCL cache and once
# without.  Compare the performance to make sure things go faster with the
# cache turned on.
#
ifcapable tclvar {
  do_test select2-2.0.1 {
    set t1 [time {
      execsql {CREATE TABLE tbl2(f1 int, f2 int, f3 int); BEGIN;}
      for {set i 1} {$i<=30000} {incr i} {
        set i2 [expr {$i*2}]
        set i3 [expr {$i*3}]
        db eval {INSERT INTO tbl2 VALUES($i,$i2,$i3)}
      }
      execsql {COMMIT}
    }]
    set result {}
  } {}
  puts "time with cache: $::t1"
}
catch {execsql {DROP TABLE tbl2}}
do_test select2-2.0.2 {
  set t2 [time {
    execsql {CREATE TABLE tbl2(f1 int, f2 int, f3 int); BEGIN;}
    for {set i 1} {$i<=30000} {incr i} {
      set i2 [expr {$i*2}]
      set i3 [expr {$i*3}]
      execsql "INSERT INTO tbl2 VALUES($i,$i2,$i3)"
    }
    execsql {COMMIT}
  }]
  set result {}
} {}
puts "time without cache: $t2"
ifcapable tclvar {
  do_test select2-2.0.3 {
    expr {[lindex $t1 0]<[lindex $t2 0]}
  } 1
}

do_test select2-2.1 {
  execsql {SELECT count(*) FROM tbl2}
} {30000}
do_test select2-2.2 {
  execsql {SELECT count(*) FROM tbl2 WHERE f2>1000}
} {29500}