Created
September 9, 2016 05:50
-
-
Save x4m/9568455976007295f1e98e8f50da65d0 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
\timing | |
SET client_min_messages = 'DEBUG5'; | |
SET log_min_messages = 'DEBUG5'; | |
SET wal_level = 'minimal'; | |
create extension if not exists cube; | |
begin transaction; | |
SELECT setseed(.43); | |
create table dataTable as select cube(array[random()*1E20,random()*1E20,random()*1E20]) c from generate_series(1,1e6,1); | |
create index idx on dataTable using gist(c); | |
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)*1E20,(l2+0.1)*1E20,(l3+0.1)*1E20]); | |
select id,(select count(*) from dataTable dt where dt.c<@q) from queries ; | |
select pg_size_pretty(pg_relation_size('idx')); | |
rollback; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment