Changeset 63
- Timestamp:
- 10/15/07 13:13:03 (5 years ago)
- Location:
- hw/hw2/MyStuff
- Files:
-
- 2 modified
-
runtests.sh (modified) (2 diffs)
-
runtests_setup.sql (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hw/hw2/MyStuff/runtests.sh
r62 r63 1 1 #!/bin/csh 2 2 3 # restart server so that it chooses index scan over heap scan4 pg_ctl restart -o "-fs -fb"5 sleep 56 3 7 4 #### … … 11 8 mkdir -p runtests.out 12 9 13 # set up tables14 psql -q - f runtests_setup.sql10 # run queries 11 psql -q -t -f runtests_setup.sql 15 12 16 #### Make sure basic near neighbor works on a few tuples 17 #### 18 # SeqScan: 19 psql -c "select 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" >! runtests.out/1 20 # index 21 psql -c "select 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" >! runtests.out/2 13 # check output 22 14 if ( `diff runtests.out/1 runtests.out/2` != '' ) echo 'OnePageNN failure' 23 24 #### Bigger tables25 ####26 # SeqScan:27 psql -c "select 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" >! runtests.out/328 # index29 psql -c "select 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" >! runtests.out/430 15 if ( `diff runtests.out/3 runtests.out/4` != '' ) echo 'BasicNN failure' 31 32 ####33 #### Make sure selections work34 ####35 # SeqScan:36 psql -c "select 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" >! runtests.out/537 # index38 psql -c "select 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)'" >! runtests.out/639 16 if ( `diff runtests.out/5 runtests.out/6` != '' ) echo 'SelectionNN failure' 40 41 #### 42 #### Rectangle query 43 #### 44 # Check the answer sets are the same 45 if ( `psql -t -c "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)' 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)'"` != '' ) echo 'Rectangle failure: mismatch on zeros' 46 # SeqScan: 47 psql -c "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)' and box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') > 0 order by dist" >! runtests.out/7 48 # index 49 psql -c "select 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" >! runtests.out/8 17 if ( `cat runtests.out/10` != '') echo 'Rectangle failure: mismatch on zeros' 50 18 if ( `diff runtests.out/7 runtests.out/8` != '' ) echo 'Rectangle failure' -
hw/hw2/MyStuff/runtests_setup.sql
r61 r63 2 2 -- Change the paths in the copy commands to get this working! 3 3 -- 4 5 4 drop table if exists testgist; 6 5 drop table if exists testscan; … … 8 7 drop table if exists testscan25; 9 8 create table testgist(id integer, the_box box); 10 copy testgist from '/Users/joeh/devel/ Hw2/MyStuff/randomboxes' delimiter ';' ;9 copy testgist from '/Users/joeh/devel/hw2/MyStuff/randomboxes' delimiter ';' ; 11 10 create index testgistix on testgist using gist (the_box box_ops); 12 11 13 12 create table testscan(id integer, the_box box); 14 copy testscan from '/Users/joeh/devel/ Hw2/MyStuff/randomboxes' delimiter ';' ;13 copy testscan from '/Users/joeh/devel/hw2/MyStuff/randomboxes' delimiter ';' ; 15 14 16 15 create table testgist25 (id integer, the_box box); 17 copy testgist25 from '/Users/joeh/devel/ Hw2/MyStuff/randomboxes25' delimiter ';' ;16 copy testgist25 from '/Users/joeh/devel/hw2/MyStuff/randomboxes25' delimiter ';' ; 18 17 create index testgist25ix on testgist25 using gist (the_box box_ops); 19 18 20 19 create table testscan25(id integer, the_box box); 21 copy testscan25 from '/Users/joeh/devel/Hw2/MyStuff/randomboxes25' delimiter ';' ; 20 copy testscan25 from '/Users/joeh/devel/hw2/MyStuff/randomboxes25' delimiter ';' ; 21 22 23 -- 24 -- Run queries 25 -- 26 27 -- 28 -- Make sure basic near neighbor works on a few tuples 29 -- 30 -- SeqScan: 31 set enable_seqscan to off; 32 \o runtests.out/1 33 select 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; 34 -- index 35 \o runtests.out/2 36 select 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; 37 38 -- Bigger tables 39 -- 40 -- SeqScan: 41 \o runtests.out/3 42 select 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; 43 -- index 44 \o runtests.out/4 45 select 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; 46 47 -- 48 -- Make sure selections work 49 -- 50 -- SeqScan: 51 \o runtests.out/5 52 select 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; 53 -- index 54 \o runtests.out/6 55 select 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)'; 56 57 -- 58 -- Rectangle query 59 -- 60 -- Check the answer sets are the same 61 \o runtests.out/10 62 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)' 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)'; 63 -- SeqScan: 64 \o runtests.out/7 65 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)' and box_mindistance(the_box, '(0.5,0.7,0.5,0.7)') > 0 order by dist; 66 -- index 67 \o runtests.out/8 68 select 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; 69 70 71 -- 72 -- Drop tables 73 -- 74 drop table testscan; 75 drop table testgist; 76 drop table testscan25; 77 drop table testgist25;
