/ Check-in [7edf39eb]
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:Fully constraint the ORDER BY on the top-10 line of the --summary output from the wordcount test program. Add the run-wordcount.bash script for running wordcount in various configurations.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7edf39eb93a8f9059a788f5fccf41c2be40afd4d
User & Date: drh 2013-11-16 15:35:18
Context
2013-11-18
03:11
Enable the ONEPASS optimization for DELETE, for both rowid and WITHOUT ROWID tables. check-in: 44a07afd user: drh tags: trunk
2013-11-16
20:13
Enhance the DELETE logic so that it can make use of WHERE_ONEPASS_DESIRED for rowid tables. check-in: 8f479a72 user: drh tags: optimize-delete
15:35
Fully constraint the ORDER BY on the top-10 line of the --summary output from the wordcount test program. Add the run-wordcount.bash script for running wordcount in various configurations. check-in: 7edf39eb user: drh tags: trunk
14:03
Avoid unnecessary OP_IfNull checks when doing a range query where there is a constraint on the lower bound of the range. check-in: de08a7e7 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Added test/run-wordcount.bash.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
#
# This script runs the wordcount program in different ways, comparing
# the output from each.
#


# Run the wordcount command with argument supplied and with --summary.
# Store the results in wc-out.txt and report the run-time.
#
function time_wordcount {
  /usr/bin/time --format='%e %C' ./wordcount --summary $* >wc-out.txt
}

# Compare wc-out.txt against wc-baseline.txt and report any differences.
#
function compare_results {
  if cmp -s wc-out.txt wc-baseline.txt;
  then echo hi >/dev/null;
  else echo ERROR:;
       diff -u wc-baseline.txt wc-out.txt;
  fi
}

# Select the source text to be analyzed.
#
if test "x$1" = "x";
then echo "Usage: $0 FILENAME [ARGS...]"; exit 1;
fi

# Do test runs
#
rm -f wcdb1.db
time_wordcount wcdb1.db $* --insert
mv wc-out.txt wc-baseline.txt
rm -f wcdb2.db
time_wordcount wcdb2.db $* --insert --without-rowid
compare_results

rm -f wcdb1.db
time_wordcount wcdb1.db $* --replace
compare_results
rm -f wcdb2.db
time_wordcount wcdb2.db $* --replace --without-rowid
compare_results

rm -f wcdb1.db
time_wordcount wcdb1.db $* --select
compare_results
rm -f wcdb2.db
time_wordcount wcdb2.db $* --select --without-rowid
compare_results

time_wordcount wcdb1.db $* --query
mv wc-out.txt wc-baseline.txt
time_wordcount wcdb2.db $* --query --without-rowid
compare_results

time_wordcount wcdb1.db $* --delete
mv wc-out.txt wc-baseline.txt
time_wordcount wcdb2.db $* --delete --without-rowid
compare_results

# Clean up temporary files created.
#
rm -rf wcdb1.db wcdb2.db wc-out.txt wc-baseline.txt

Changes to test/wordcount.c.

455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
    sqlite3_exec(db, 
      "SELECT 'count(*):  ', count(*) FROM wordcount;\n"
      "SELECT 'sum(cnt):  ', sum(cnt) FROM wordcount;\n"
      "SELECT 'max(cnt):  ', max(cnt) FROM wordcount;\n"
      "SELECT 'avg(cnt):  ', avg(cnt) FROM wordcount;\n"
      "SELECT 'sum(cnt=1):', sum(cnt=1) FROM wordcount;\n"
      "SELECT 'top 10:    ', group_concat(word, ', ') FROM "
         "(SELECT word FROM wordcount ORDER BY cnt DESC LIMIT 10);\n"
      "SELECT 'checksum:  ', checksum(word, cnt) FROM "
         "(SELECT word, cnt FROM wordcount ORDER BY word);\n"
      "PRAGMA integrity_check;\n",
      printResult, 0, 0);
  }

  /* Database connection statistics printed after both prepared statements







|







455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
    sqlite3_exec(db, 
      "SELECT 'count(*):  ', count(*) FROM wordcount;\n"
      "SELECT 'sum(cnt):  ', sum(cnt) FROM wordcount;\n"
      "SELECT 'max(cnt):  ', max(cnt) FROM wordcount;\n"
      "SELECT 'avg(cnt):  ', avg(cnt) FROM wordcount;\n"
      "SELECT 'sum(cnt=1):', sum(cnt=1) FROM wordcount;\n"
      "SELECT 'top 10:    ', group_concat(word, ', ') FROM "
         "(SELECT word FROM wordcount ORDER BY cnt DESC, word LIMIT 10);\n"
      "SELECT 'checksum:  ', checksum(word, cnt) FROM "
         "(SELECT word, cnt FROM wordcount ORDER BY word);\n"
      "PRAGMA integrity_check;\n",
      printResult, 0, 0);
  }

  /* Database connection statistics printed after both prepared statements