mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	for haskeytype). Update GiST contrib modules too. Add linear-time split algorithm for R-tree GiST opclass. From Oleg Bartunov and Teodor Sigaev.
		
			
				
	
	
		
			46 lines
		
	
	
		
			974 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			974 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
--
 | 
						|
-- first, define the datatype.  Turn off echoing so that expected file
 | 
						|
-- does not depend on contents of seg.sql.
 | 
						|
--
 | 
						|
\set ECHO none
 | 
						|
create table boxtmp (b box);
 | 
						|
\copy boxtmp from 'data/test_box.data'
 | 
						|
select count(*) from boxtmp where b && '(1000,1000,0,0)'::box;
 | 
						|
 count 
 | 
						|
-------
 | 
						|
     2
 | 
						|
(1 row)
 | 
						|
 | 
						|
create index bix on boxtmp using rtree (b);
 | 
						|
select count(*) from boxtmp where b && '(1000,1000,0,0)'::box;
 | 
						|
 count 
 | 
						|
-------
 | 
						|
     2
 | 
						|
(1 row)
 | 
						|
 | 
						|
drop index bix;
 | 
						|
create index bix on boxtmp using gist (b);
 | 
						|
select count(*) from boxtmp where b && '(1000,1000,0,0)'::box;
 | 
						|
 count 
 | 
						|
-------
 | 
						|
     2
 | 
						|
(1 row)
 | 
						|
 | 
						|
create table polytmp (p polygon);
 | 
						|
\copy polytmp from 'data/test_box.data'
 | 
						|
create index pix on polytmp using rtree (p);
 | 
						|
select count(*) from polytmp where p && '(1000,1000),(0,0)'::polygon;
 | 
						|
 count 
 | 
						|
-------
 | 
						|
     2
 | 
						|
(1 row)
 | 
						|
 | 
						|
drop index pix;
 | 
						|
create index pix on polytmp using gist (p);
 | 
						|
select count(*) from polytmp where p && '(1000,1000),(0,0)'::polygon;
 | 
						|
 count 
 | 
						|
-------
 | 
						|
     2
 | 
						|
(1 row)
 | 
						|
 |