Hi, thanks for your interest.
I had misunderstanding phrase 'Definition of the tables on the query' - what it means, but maybe i provide next what you need, if not, please explain me what kind of information you need.
test=# \d+ test1_eurrub_comp0
Append-Only Columnar Table "public.test1_eurrub_comp0"
Column | Type | Modifiers | Storage | Compression Type | Compression Level | Block Size
-----------------+-------------------------------------------+-----------------------------------------------------------------------------------------+-----------+------------------+-------------------+------------+-------------
id | integer | not null default nextval('test1_eurrub_comp0_id_seq'::regclass) | plain | none | 0 | 32768 |
timestamp | timestamp without time zone | not null | plain | none | 0 | 32768 |
ask | double precision | not null | plain | none | 0 | 32768 |
bid | double precision | not null | plain | none | 0 | 32768 |
askvol | double precision | not null | plain | none | 0 | 32768 |
bidvol | double precision | not null | plain | none | 0 | 32768 |
Checksum: t
Has OIDs: no
Options: appendonly=true, orientation=column
Distributed by: (id)
test=> select count(*) from test1_eurrub_comp0;
count
-----------
117363948
(1 row)
test=# select pg_size_pretty(pg_relation_size('test1_eurrub_comp0'));
pg_size_pretty
----------------
4931 MB
(1 row)
This is the best result that i can get (data was cached):
test=> explain analyze select * from test1_eurrub_comp0;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
Gather Motion 6:1 (slice1; segments: 6) (cost=0.00..17958.52 rows=117363952 width=44)
Rows out: 117363948 rows at destination with 1.048 ms to first row, 16336 ms to end.
-> Table Scan on test1_eurrub_comp0 (cost=0.00..1054.99 rows=19560659 width=44)
Rows out: Avg 19560658.0 rows x 6 workers. Max 19561007 rows (seg4) with 0.981 ms to first row, 1943 ms to end.
Slice statistics:
(slice0) Executor memory: 322K bytes.
(slice1) Executor memory: 797K bytes avg x 6 workers, 797K bytes max (seg0).
Statement statistics:
Memory used: 128000K bytes
Optimizer status: PQO version 3.1.0
Total runtime: 19985.224 ms
(11 rows)