Changeset 63

Show
Ignore:
Timestamp:
10/15/07 13:13:03 (5 years ago)
Author:
cs186
Message:

Clean up tests, makes them faster too.

Location:
hw/hw2/MyStuff
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • hw/hw2/MyStuff/runtests.sh

    r62 r63  
    11#!/bin/csh 
    22 
    3 # restart server so that it chooses index scan over heap scan  
    4 pg_ctl restart -o "-fs -fb" 
    5 sleep 5 
    63 
    74#### 
     
    118mkdir -p runtests.out 
    129 
    13 # set up tables 
    14 psql -q -f runtests_setup.sql 
     10# run queries 
     11psql -q -t -f runtests_setup.sql 
    1512 
    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 
    2214if ( `diff runtests.out/1 runtests.out/2` != '' ) echo 'OnePageNN failure' 
    23  
    24 #### Bigger tables 
    25 #### 
    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/3 
    28 # index 
    29 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/4 
    3015if ( `diff runtests.out/3 runtests.out/4` != '' ) echo 'BasicNN failure' 
    31  
    32 #### 
    33 #### Make sure selections work 
    34 #### 
    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/5 
    37 # index 
    38 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/6 
    3916if ( `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 
     17if ( `cat runtests.out/10` != '') echo 'Rectangle failure: mismatch on zeros' 
    5018if ( `diff runtests.out/7 runtests.out/8` != '' ) echo 'Rectangle failure' 
  • hw/hw2/MyStuff/runtests_setup.sql

    r61 r63  
    22-- Change the paths in the copy commands to get this working! 
    33-- 
    4  
    54drop table if exists testgist; 
    65drop table if exists testscan; 
     
    87drop table if exists testscan25; 
    98create table testgist(id integer, the_box box); 
    10 copy testgist from '/Users/joeh/devel/Hw2/MyStuff/randomboxes' delimiter ';' ; 
     9copy testgist from '/Users/joeh/devel/hw2/MyStuff/randomboxes' delimiter ';' ; 
    1110create index testgistix on testgist using gist (the_box box_ops); 
    1211 
    1312create table testscan(id integer, the_box box); 
    14 copy testscan from '/Users/joeh/devel/Hw2/MyStuff/randomboxes' delimiter ';' ; 
     13copy testscan from '/Users/joeh/devel/hw2/MyStuff/randomboxes' delimiter ';' ; 
    1514 
    1615create table testgist25 (id integer, the_box box); 
    17 copy testgist25 from '/Users/joeh/devel/Hw2/MyStuff/randomboxes25' delimiter ';' ; 
     16copy testgist25 from '/Users/joeh/devel/hw2/MyStuff/randomboxes25' delimiter ';' ; 
    1817create index testgist25ix on testgist25 using gist (the_box box_ops); 
    1918 
    2019create table testscan25(id integer, the_box box); 
    21 copy testscan25 from '/Users/joeh/devel/Hw2/MyStuff/randomboxes25' delimiter ';' ; 
     20copy 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:  
     31set enable_seqscan to off; 
     32\o runtests.out/1 
     33select 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 
     36select 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 
     42select 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 
     45select 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 
     52select 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 
     55select 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 
     62select 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 
     65select 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 
     68select 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-- 
     74drop table testscan; 
     75drop table testgist; 
     76drop table testscan25; 
     77drop table testgist25;