Last active
August 29, 2015 14:06
-
-
Save depaolim/879a64256d146ddb0589 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
drop view temp_data; | |
drop table temp_int; | |
drop table temp_uuid; | |
\timing | |
create view temp_data as | |
select | |
generate_series(1000001, 2000000) as key | |
; | |
select count(1) from temp_data; | |
create table temp_int (key integer); | |
insert into temp_int select key from temp_data; | |
alter table temp_int add PRIMARY KEY (key); | |
create table temp_uuid (key character varying(36)); | |
insert into temp_uuid select uuid_in(md5(key::text)::cstring) from temp_data; | |
alter table temp_uuid add PRIMARY KEY (key); | |
analyze temp_int; | |
analyze temp_uuid; | |
select max(key) from temp_int; | |
select max(key) from temp_uuid; | |
select key from temp_int where key = (select min(key) from temp_int); | |
select key from temp_uuid where key = (select min(key) from temp_uuid); | |
\timing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment