$ time perl llil.pl big1.txt big2.txt big3.txt > big.tmp
llil start
get_properties : 6 secs
sort + output : 78 secs
total : 84 secs
real 1m28,236s
user 1m27,327s
sys 0m0,816s
####
CREATE TABLE llil_raw (
name text,
count bigint
);
-- INDEX makes it *way* slower
--CREATE INDEX llil_raw_idx ON llil_raw(name);
COPY llil_raw (name, count) FROM '/home/cavac/src/long_list_is_long/big1.txt' ( FORMAT TEXT);
COPY llil_raw (name, count) FROM '/home/cavac/src/long_list_is_long/big2.txt' ( FORMAT TEXT);
COPY llil_raw (name, count) FROM '/home/cavac/src/long_list_is_long/big3.txt' ( FORMAT TEXT);
CREATE TABLE llil_result (
name text,
count bigint
);
INSERT INTO llil_result (name, count)
SELECT name, sum(count) AS total FROM llil_raw GROUP BY name ORDER BY total;
COPY llil_result (name, count) TO '/home/cavac/src/long_list_is_long/result.txt' ( FORMAT TEXT);
DROP TABLE llil_result;
DROP TABLE llil_raw;
##
##
$ time psql -U Earthrise_Server -d Test_DB -f llil.sql
CREATE TABLE
COPY 3515200
COPY 3515200
COPY 3515200
CREATE TABLE
INSERT 0 10367359
COPY 10367359
DROP TABLE
DROP TABLE
real 0m19,675s
user 0m0,022s
sys 0m0,009s