root / hw / hw2 / MyStuff / runtests_setup.sql

Revision 64, 3.0 kB (checked in by cs186, 4 years ago)

make sure to turn off bitmap scans too!

Line 
1--
2-- Change the paths in the copy commands to get this working!
3--
4drop table if exists testgist;
5drop table if exists testscan;
6drop table if exists testgist25;
7drop table if exists testscan25;
8create table testgist(id integer, the_box box);
9copy testgist from '/home/cc/cs186/fa07/class/cs186-ee/Hw2/MyStuff/randomboxes' delimiter ';' ;
10create index testgistix on testgist using gist (the_box box_ops);
11
12create table testscan(id integer, the_box box);
13copy testscan from '/home/cc/cs186/fa07/class/cs186-ee/Hw2/MyStuff/randomboxes' delimiter ';' ;
14
15create table testgist25 (id integer, the_box box);
16copy testgist25 from '/home/cc/cs186/fa07/class/cs186-ee/Hw2/MyStuff/randomboxes25' delimiter ';' ;
17create index testgist25ix on testgist25 using gist (the_box box_ops);
18
19create table testscan25(id integer, the_box box);
20copy testscan25 from '/home/cc/cs186/fa07/class/cs186-ee/Hw2/MyStuff/randomboxes25' delimiter ';' ;
21
22--
23-- Run queries
24--
25
26--
27-- Make sure basic near neighbor works on a few tuples
28--
29-- SeqScan:
30set enable_seqscan to off;
31set enable_bitmapscan to off;
32
33\o runtests.out/1
34select id, box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') as dist from testscan25 where the_box ~~ '(0.5,0.5,0.5,0.5)' and box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') > 0 order by dist;
35-- index
36\o runtests.out/2
37select id, box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') as dist from testgist25 where the_box ~~ '(0.5,0.5,0.5,0.5)' and box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') > 0;
38
39-- Bigger tables
40--
41-- SeqScan:
42\o runtests.out/3
43select id, box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') as dist from testscan where the_box ~~ '(0.5,0.5,0.5,0.5)' and box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') > 0 order by dist;
44-- index
45\o runtests.out/4
46select id, box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') as dist from testgist where the_box ~~ '(0.5,0.5,0.5,0.5)' and box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') > 0;
47
48--
49-- Make sure selections work
50--
51-- SeqScan:
52\o runtests.out/5
53select id, box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') as dist from testscan where the_box >> '(0.5,0.5,0.5,0.5)' order by dist;
54-- index
55\o runtests.out/6
56select id, box_mindistance(the_box, '(0.5,0.5,0.5,0.5)') as dist from testgist where the_box >> '(0.5,0.5,0.5,0.5)';
57
58--
59-- Rectangle query
60--
61-- Check the answer sets are the same
62\o runtests.out/10
63select id, box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') as dist from testscan where the_box ~~ '(0.5,0.7,0.5,0.7)' except select id, box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') as dist from testscan where the_box ~~ '(0.5,0.7,0.5,0.7)';
64-- SeqScan:
65\o runtests.out/7
66select id, box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') as dist from testscan where the_box ~~ '(0.5,0.7,0.5,0.7)' and box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') > 0 order by dist;
67-- index
68\o runtests.out/8
69select id, box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') as dist from testgist where the_box ~~ '(0.5,0.7,0.5,0.7)' and box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') > 0;
70
71
72--
73-- Drop tables
74--
75drop table testscan;
76drop table testgist;
77drop table testscan25;
78drop table testgist25;
Note: See TracBrowser for help on using the browser.