sqllogictest
Check-in [599e260e37]
Not logged in

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

Overview
Comment:Add the select5 test script that stresses multi-way joins up to 64 deep.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 599e260e37e77c726436f51e485ec102d087b710
User & Date: drh 2008-12-03 00:44:45
Context
2008-12-05
20:33
Added "skipif" logic. Added xGetEngineName() method to each interface. This may be different then the registered named for ODBC connections, "ODBC3". Various tweaks to error messges. check-in: 0a1f217d6b user: shaneh tags: trunk
2008-12-03
00:44
Add the select5 test script that stresses multi-way joins up to 64 deep. check-in: 599e260e37 user: drh tags: trunk
2008-12-02
23:08
Extend the select4 test script to do lots of multi-way joins. check-in: e9c99b6893 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added proto/select5.proto.

more than 10,000 changes

Added proto/select5.tcl.

































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
#!/usr/bin/tclsh
#
# Run this script to generate a larger prototype test script for
# sqllogictest.
#
# Thirty separate tables, T1 through T30, each with an integer primary
# key, integer data, and a text identifier.  The primary keys are
# numbered from 1 to 30.  Data is the same 30 integers scrambled.
# Used to test deep joins.
#
expr {srand(0)}

# Scramble the $inlist list into a random order.
#
proc scramble {inlist} {
  set y {}
  foreach x $inlist {
    lappend y [list [expr {rand()}] $x]
  }
  set y [lsort $y]
  set outlist {}
  foreach x $y {
    lappend outlist [lindex $x 1]
  }
  return $outlist
}

set N 64
set M 10
set sequence {}
for {set i 1} {$i<=$M} {incr i} {
  lappend sequence $i
}
set tableset {}
set tablenums {}

# Create $N tables each with $M entries
#
for {set tn 1} {$tn<=$N} {incr tn} {
  lappend tableset t$tn
  lappend tablenums $tn
  set sql "CREATE TABLE t${tn}(\n"
  append sql "  a$tn INTEGER PRIMARY KEY,\n"
  append sql "  b$tn INTEGER,\n"
  append sql "  x$tn VARCHAR(40)\n"
  append sql ")"
  puts "statement ok\n$sql\n"

  foreach a $sequence b [scramble $sequence] {
    set sql "INSERT INTO t$tn VALUES($a,$b,'table t$tn row $a')"
    puts "statement ok\n$sql\n"
  }
}

# Generate a deep join
#
proc generate_deep_join {depth i} {
  global sequence tablenums M

  set tset1 [lrange [scramble $tablenums] 0 [expr {$depth-1}]]
  set tset2 [scramble $tset1]
  set typestr [string range \
    TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT \
    1 $depth]

  set head "SELECT x[join $tset1 ",x"]\n"
  unset -nocomplain seen
  set initw a[lindex $tset2 end]=[expr {int(rand()*$M)+1}]
  for {set j 0} {$j<3} {incr j} {
    set from "  FROM t[join [scramble $tset2] ",t"]\n"
    set w $initw
    foreach a [lrange $tset2 1 end] b [lrange $tset2 0 end-1] {
      if {rand()<0.5} {
        lappend w a$a=b$b
      } else {
        lappend w b$b=a$a
      }
    }
    set where " WHERE [join [scramble $w] "\n   AND "]"
    set sql $head$from$where
    if {[info exists seen($sql)]} {
      incr j -1
      continue
    }
    set seen($sql) 1
    puts "query $typestr valuesort join-$depth-$i\n$head$from$where\n"
  }
}

# Generate deep joins
#
for {set depth 4} {$depth<=$N} {incr depth} {
  for {set i 1} {$i<=4} {incr i} {
    generate_deep_join $depth $i
  }
}

Added test/select5.test.

more than 10,000 changes