Performance with left join

From: Glenn Pierce <glennpierce(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Performance with left join
Date: 2014-03-28 09:43:49
Message-ID: CAM5ipV_OiqS0OLnZaH0aj6RKHhOzGYcFC7EG_BudmX99RV_Ymw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi I am having trouble understanding a performance issue.
I have two identical structured tables sensor_values and
sensor_values_cleaned
The structure is

CREATE TABLE sensor_values
(
ts timestamp with time zone NOT NULL,
value double precision NOT NULL DEFAULT 'NaN'::real,
sensor_id integer NOT NULL,
CONSTRAINT sensor_values_sensor_id_fkey FOREIGN KEY (sensor_id)
REFERENCES sensors (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT timestamp_sensor_index UNIQUE (ts, sensor_id)
)

There are indexes of the ts and sensor_id fields of both tables.
(The tables are actually many partition tables split by yearly quarters)

The problem query is

SELECT MIN(s1.ts)::timestamptz(0) AS min_time, AVG(s1.value), AVG(s2.value)
FROM sensor_values s1 LEFT JOIN sensor_values_cleaned s2 USING
(sensor_id,ts)
WHERE s1.ts::timestamptz >=
'2011-02-25T20:25:07.192132+00:00'::timestamptz AND s1.ts::timestamptz <=
'2012-12-31T23:59:59.999999'::timestamp
AND s1.sensor_id IN (904 ) GROUP BY s1.ts::timestamptz ORDER BY 1 DESC

The idea is to get the original data and cleaned data for each sensor_id.
My original query does a pivot on this data but I have removed it as that
part is not slow.

sensor_id 904 has 88000 rows in sensor_values and 0 in sensor_values_cleaned

This query takes ~1300 ms after multiple runs.
The problem is when I add to the IN clause

ie

SELECT MIN(s1.ts)::timestamptz(0) AS min_time, AVG(s1.value), AVG(s2.value)
FROM sensor_values s1 LEFT JOIN sensor_values_cleaned s2 USING
(sensor_id,ts)
WHERE s1.ts::timestamptz >=
'2011-02-25T20:25:07.192132+00:00'::timestamptz AND s1.ts::timestamptz <=
'2012-12-31T23:59:59.999999'::timestamp
AND s1.sensor_id IN (904, 967 ) GROUP BY s1.ts::timestamptz ORDER BY 1 DESC

Takes 15 seconds with caching. On first run it took 40 !

sensor id 967 has 69600 rows in sensor_values and 0 in
sensor_values_cleaned.

I have done a VACUUM ANALYZE

Any one know the issue or havd advice ?

There are quite a few Seq Scan on sensor_values_cleaned.
The indexes are present though.

Thanks

My query analyse is below

"Sort (cost=591617.09..592108.32 rows=196489 width=24) (actual
time=42681.590..42697.469 rows=23726 loops=1)"
" Sort Key: ((min(s1.ts))::timestamp(0) with time zone)"
" Sort Method: quicksort Memory: 2181kB"
" -> HashAggregate (cost=570903.14..574341.69 rows=196489 width=24)
(actual time=42621.109..42650.345 rows=23726 loops=1)"
" -> Hash Left Join (cost=479570.32..568938.25 rows=196489
width=24) (actual time=38263.185..42579.388 rows=23726 loops=1)"
" Hash Cond: ((s1.sensor_id = s2.sensor_id) AND (s1.ts =
s2.ts))"
" -> Append (cost=0.00..9889.73 rows=196489 width=20)
(actual time=0.066..60.094 rows=23726 loops=1)"
" -> Seq Scan on sensor_values s1 (cost=0.00..0.00
rows=1 width=20) (actual time=0.006..0.006 rows=0 loops=1)"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2011q1_sensor_id_idx on sensor_values_2011q1 s1
(cost=0.00..12.80 rows=1 width=20) (actual time=0.026..0.026 rows=0
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2011q2_sensor_id_idx on sensor_values_2011q2 s1
(cost=0.00..54.67 rows=1195 width=20) (actual time=0.031..1.535 rows=1178
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2011q3_sensor_id_idx on sensor_values_2011q3 s1
(cost=0.00..914.95 rows=22670 width=20) (actual time=0.031..29.946
rows=22548 loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2011q4_sensor_id_idx on sensor_values_2011q4 s1
(cost=0.00..8.94 rows=1 width=20) (actual time=0.011..0.011 rows=0
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2012q1_sensor_id_idx on sensor_values_2012q1 s1
(cost=0.00..1823.47 rows=39681 width=20) (actual time=0.011..0.011 rows=0
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2012q2_sensor_id_idx on sensor_values_2012q2 s1
(cost=0.00..1729.12 rows=38172 width=20) (actual time=0.011..0.011 rows=0
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2012q3_sensor_id_idx on sensor_values_2012q3 s1
(cost=0.00..2657.86 rows=49181 width=20) (actual time=0.010..0.010 rows=0
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2012q4_sensor_id_idx on sensor_values_2012q4 s1
(cost=0.00..2405.54 rows=45555 width=20) (actual time=0.011..0.011 rows=0
loops=1)"
" Index Cond: (sensor_id = ANY
('{904,967}'::integer[]))"
" Filter: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" -> Index Scan using
sensor_values_2013q1_timestamp_inx on sensor_values_2013q1 s1
(cost=0.00..9.42 rows=1 width=20) (actual time=0.007..0.007 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" Filter: (sensor_id = ANY
('{904,967}'::integer[]))"
" -> Index Scan using
sensor_values_2013q2_timestamp_inx on sensor_values_2013q2 s1
(cost=0.00..9.46 rows=1 width=20) (actual time=0.007..0.007 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" Filter: (sensor_id = ANY
('{904,967}'::integer[]))"
" -> Index Scan using
sensor_values_2013q3_timestamp_inx on sensor_values_2013q3 s1
(cost=0.00..9.37 rows=1 width=20) (actual time=0.007..0.007 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" Filter: (sensor_id = ANY
('{904,967}'::integer[]))"
" -> Index Scan using
sensor_values_2013q4_timestamp_inx on sensor_values_2013q4 s1
(cost=0.00..9.44 rows=1 width=20) (actual time=0.006..0.006 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" Filter: (sensor_id = ANY
('{904,967}'::integer[]))"
" -> Index Scan using
sensor_values_2014q1_timestamp_inx on sensor_values_2014q1 s1
(cost=0.00..9.52 rows=1 width=20) (actual time=0.007..0.007 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone))"
" Filter: (sensor_id = ANY
('{904,967}'::integer[]))"
" -> Index Scan using
sensor_values_2014q2_ts_sensor_unq on sensor_values_2014q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.004..0.004 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2014q3_ts_sensor_unq on sensor_values_2014q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2014q4_ts_sensor_unq on sensor_values_2014q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2015q1_ts_sensor_unq on sensor_values_2015q1 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2015q2_ts_sensor_unq on sensor_values_2015q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2015q3_ts_sensor_unq on sensor_values_2015q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2015q4_ts_sensor_unq on sensor_values_2015q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2016q1_ts_sensor_unq on sensor_values_2016q1 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2016q2_ts_sensor_unq on sensor_values_2016q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2016q3_ts_sensor_unq on sensor_values_2016q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2016q4_ts_sensor_unq on sensor_values_2016q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2017q1_ts_sensor_unq on sensor_values_2017q1 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2017q2_ts_sensor_unq on sensor_values_2017q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2017q3_ts_sensor_unq on sensor_values_2017q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2017q4_ts_sensor_unq on sensor_values_2017q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2018q1_ts_sensor_unq on sensor_values_2018q1 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.004..0.004 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2018q2_ts_sensor_unq on sensor_values_2018q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.004..0.004 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2018q3_ts_sensor_unq on sensor_values_2018q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2018q4_ts_sensor_unq on sensor_values_2018q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2019q1_ts_sensor_unq on sensor_values_2019q1 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2019q2_ts_sensor_unq on sensor_values_2019q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2019q3_ts_sensor_unq on sensor_values_2019q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2019q4_ts_sensor_unq on sensor_values_2019q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2020q1_ts_sensor_unq on sensor_values_2020q1 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2020q2_ts_sensor_unq on sensor_values_2020q2 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2020q3_ts_sensor_unq on sensor_values_2020q3 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Index Scan using
sensor_values_2020q4_ts_sensor_unq on sensor_values_2020q4 s1
(cost=0.00..8.71 rows=1 width=20) (actual time=0.003..0.003 rows=0
loops=1)"
" Index Cond: ((ts >= '2011-02-25
20:25:07.192132+00'::timestamp with time zone) AND (ts <= '2012-12-31
23:59:59.999999'::timestamp without time zone) AND (sensor_id = ANY
('{904,967}'::integer[])))"
" -> Hash (cost=214136.32..214136.32 rows=13029933 width=20)
(actual time=38261.512..38261.512 rows=12978632 loops=1)"
" Buckets: 262144 Batches: 8 Memory Usage: 63455kB"
" -> Append (cost=0.00..214136.32 rows=13029933
width=20) (actual time=0.019..25614.299 rows=12978632 loops=1)"
" -> Seq Scan on sensor_values_cleaned s2
(cost=0.00..0.00 rows=1 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2008q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2008q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.000..0.000 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2008q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2008q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2009q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.000..0.000 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2009q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2009q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2009q4 s2
(cost=0.00..2541.23 rows=155223 width=20) (actual time=0.006..127.251
rows=155223 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2010q1 s2
(cost=0.00..2677.47 rows=163547 width=20) (actual time=0.004..133.358
rows=163547 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2010q2 s2
(cost=0.00..2826.47 rows=172647 width=20) (actual time=0.006..133.242
rows=172647 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2010q3 s2
(cost=0.00..2867.73 rows=175173 width=20) (actual time=0.004..148.261
rows=175173 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2010q4 s2
(cost=0.00..3458.36 rows=211236 width=20) (actual time=0.007..166.847
rows=211236 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2011q1 s2
(cost=0.00..3088.72 rows=188672 width=20) (actual time=0.005..153.650
rows=188672 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2011q2 s2
(cost=0.00..3324.49 rows=203049 width=20) (actual time=0.007..164.005
rows=203049 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2011q3 s2
(cost=0.00..3447.54 rows=210554 width=20) (actual time=0.005..168.641
rows=210554 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2011q4 s2
(cost=0.00..3437.25 rows=209925 width=20) (actual time=0.004..162.842
rows=209925 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2012q1 s2
(cost=0.00..5061.45 rows=309145 width=20) (actual time=0.004..241.639
rows=309145 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2012q2 s2
(cost=0.00..13614.90 rows=822690 width=20) (actual time=0.005..672.308
rows=822690 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2012q3 s2
(cost=0.00..24117.15 rows=1452715 width=20) (actual time=0.006..1145.224
rows=1452715 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2012q4 s2
(cost=0.00..24191.32 rows=1457232 width=20) (actual time=0.005..1112.231
rows=1457232 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2013q1 s2
(cost=0.00..22728.12 rows=1388412 width=20) (actual time=0.004..1058.864
rows=1388412 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2013q2 s2
(cost=0.00..23573.43 rows=1440043 width=20) (actual time=0.005..1101.494
rows=1440043 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2013q3 s2
(cost=0.00..24149.37 rows=1475237 width=20) (actual time=0.003..1120.468
rows=1475237 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2013q4 s2
(cost=0.00..24905.49 rows=1521449 width=20) (actual time=0.004..1258.451
rows=1521449 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2014q1 s2
(cost=0.00..23272.43 rows=1421643 width=20) (actual time=0.004..1109.621
rows=1421683 loops=1)"
" -> Seq Scan on sensor_values_cleaned_2014q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2014q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.000..0.000 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2014q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2015q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2015q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2015q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2015q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2016q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2016q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2016q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2016q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2017q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2017q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2017q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.000..0.000 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2017q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2018q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2018q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2018q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2018q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.000..0.000 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2019q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2019q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2019q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2019q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2020q1 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.000..0.000 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2020q2 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2020q3 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
" -> Seq Scan on sensor_values_cleaned_2020q4 s2
(cost=0.00..25.10 rows=1510 width=20) (actual time=0.001..0.001 rows=0
loops=1)"
"Total runtime: 42778.185 ms"

Browse pgsql-general by date

  From Date Subject
Next Message Khangelani Gama 2014-03-28 09:56:51 Re: Synchronizing a table that is in two different databases : Need to dump a table as inserts from db1 and change the insert statements into UPDATE statements
Previous Message Reynold PJ 2014-03-28 09:33:08 Re: [GENERAL] openvz and shared memory trouble