Last active
February 18, 2016 16:12
-
-
Save x4m/8c8e9728737edd78dfb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table dataTable(c cube); | |
create index idx on dataTable using gist(c); | |
insert into dataTable(c) select cube(array[random(),random(),random()]) from generate_series(1,1e5,1); | |
drop table queries; | |
create table queries(id int,l1 float,l2 float,l3 float, u1 float,u2 float, u3 float, q cube); | |
insert into queries(id,l1,l2,l3) select s,random(),random(),random() from generate_series(1,1e4,1) s; | |
update queries set q = cube(array[l1,l2,l3],array[l1+0.1,l2+0.1,l3+0.1]); | |
select id,(select count(*) from dataTable dt where dt.c<@q) from queries; | |
drop index idx; | |
drop table dataTable; | |
--select id,(select count(*) from dataTable dt where dt.c<@q) from queries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment