DROP TABLE IF EXISTS log_details; DROP TABLE IF EXISTS log; DROP TABLE IF EXISTS key_description; DROP TABLE IF EXISTS value_types; CREATE TABLE value_types ( valuetypeid bigint PRIMARY KEY, description varchar(256) NOT NULL -- e.g. 'float', 'integer', 'boolean' ); CREATE TABLE key_description ( keyid bigint PRIMARY KEY, description varchar(256) NOT NULL, -- e.g. 'Raumtemperatur', 'Kesseltemperatur' fk_valuetypeid bigint NOT NULL, unit varchar(256) NOT NULL, -- e.g. '°C' FOREIGN KEY(fk_valuetypeid) REFERENCES value_types(valuetypeid) ON DELETE RESTRICT ); CREATE TABLE log ( id bigserial PRIMARY KEY, datetime timestamp with time zone NOT NULL, tdate date NOT NULL, ttime time with time zone NOT NULL ); CREATE TABLE log_details ( fk_id bigint NOT NULL, fk_keyid bigint NOT NULL, value double precision NOT NULL, -- Action for the log table when the id is deleted => log_details are deleted, too. FOREIGN KEY (fk_id) REFERENCES log(id) ON DELETE CASCADE, --FOREIGN KEY (fk_id) REFERENCES log(id) ON DELETE RESTRICT, FOREIGN KEY (fk_keyid) REFERENCES key_description(keyid) ON DELETE RESTRICT, CONSTRAINT unique_key_and_id UNIQUE(fk_id, fk_keyid) ); DROP INDEX IF EXISTS i_log_unique; CREATE UNIQUE INDEX i_log_unique ON log ( datetime, tdate, ttime ); DROP INDEX IF EXISTS i_day01; CREATE INDEX i_day01 ON log(TIMEZONE('GMT+01', datetime)); DROP INDEX IF EXISTS i_day02; CREATE INDEX i_day02 ON log(TIMEZONE('GMT+02', datetime)); DROP INDEX IF EXISTS i_day_date01; CREATE INDEX i_day_char01 ON log(DATE(TIMEZONE('GMT+01', datetime))); DROP INDEX IF EXISTS i_day_date02; CREATE INDEX i_day_char02 ON log(DATE(TIMEZONE('GMT+02', datetime))); INSERT INTO value_types (valuetypeid, description) VALUES (1, 'float'); INSERT INTO value_types (valuetypeid, description) VALUES (2, 'integer'); INSERT INTO value_types (valuetypeid, description) VALUES (3, 'boolean'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES ( 2, 'Kesselsolltemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES ( 3, 'Speichersolltemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES ( 4, 'Vorlaufsolltemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (12, 'Aussentemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (13, 'Kesseltemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (14, 'Speichertemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (15, 'Vorlauftemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (17, 'Raumtemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (18, 'Raumsolltemperatur', 1, '°C'); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (81, 'Brenner', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (82, 'Heizkreispumpe', 3, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (83, 'Speicherladepumpe', 3, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (86, 'Mischer auf', 3, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (87, 'Mischer zu', 3, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (88, 'Heizkreis Status', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (89, 'Speicher Status', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (1000001, 'Heizkreis Status Bedien', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (1000002, 'Speicher Status Bedien', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (1000003, 'Heizkreis Status Kessel', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (1000004, 'Speicher Status Kessel', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (1000005, 'Programmschalterstellung Bedien', 2, ''); INSERT INTO key_description (keyid, description, fk_valuetypeid, unit) VALUES (1000006, 'Programmschalterstellung Kessel', 2, ''); -- INSERT AROUND 365*24*60 data entries VACUUM FULL ANALYZE; SELECT COUNT(id) FROM log; -- 525616 SELECT COUNT(fk_id) FROM log_details; -- 10512320 SELECT COUNT(keyid) FROM key_description; -- 22 SELECT COUNT(valuetypeid) FROM value_types; -- 3 -- 8GB RAM SELECT version(); -- PostgreSQL 8.3.7 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7) --EXPLAIN SELECT id, datetime FROM log WHERE datetime >= '1970-01-01 00:00:00+02' AND datetime < '1970-01-02 00:00:00+02' ORDER BY datetime DESC LIMIT 1; --EXPLAIN SELECT l.id AS id, l.datetime AS datetime, l.tdate AS tdate, l.ttime AS ttime, d1.value AS Raumsolltemperatur, d2.value AS Raumtemperatur, d3.value AS Kesselsolltemperatur, d4.value AS Kesseltemperatur, d5.value AS Speichersolltemperatur, d6.value AS Speichertemperatur, d7.value AS Vorlaufsolltemperatur, d8.value AS Vorlauftemperatur, d9.value AS Aussentemperatur, d10.value AS Brenner, d11.value AS Heizkreispumpe, d12.value AS Speicherladepumpe, d13.value AS Mischer_auf, d14.value AS Mischer_zu, d15.value AS Heizkreis_Status_Bedien, d16.value AS Speicher_Status_Bedien, d17.value AS Heizkreis_Status_Kessel, d18.value AS Speicher_Status_Kessel, d19.value AS Programmschalterstellung_Bedien, d20.value AS Programmschalterstellung_Kessel FROM log l -- Order is relevant here LEFT OUTER JOIN key_description k1 ON k1.description = 'Raumsolltemperatur' LEFT OUTER JOIN log_details d1 ON l.id = d1.fk_id AND d1.fk_keyid = k1.keyid -- Order is relevant here LEFT OUTER JOIN key_description k2 ON k2.description = 'Raumtemperatur' LEFT OUTER JOIN log_details d2 ON l.id = d2.fk_id AND d2.fk_keyid = k2.keyid -- Order is relevant here LEFT OUTER JOIN key_description k3 ON k3.description = 'Kesselsolltemperatur' LEFT OUTER JOIN log_details d3 ON l.id = d3.fk_id AND d3.fk_keyid = k3.keyid -- Order is relevant here LEFT OUTER JOIN key_description k4 ON k4.description = 'Kesseltemperatur' LEFT OUTER JOIN log_details d4 ON l.id = d4.fk_id AND d4.fk_keyid = k4.keyid -- Order is relevant here LEFT OUTER JOIN key_description k5 ON k5.description = 'Speichersolltemperatur' LEFT OUTER JOIN log_details d5 ON l.id = d5.fk_id AND d5.fk_keyid = k5.keyid -- Order is relevant here LEFT OUTER JOIN key_description k6 ON k6.description = 'Speichertemperatur' LEFT OUTER JOIN log_details d6 ON l.id = d6.fk_id AND d6.fk_keyid = k6.keyid -- Order is relevant here LEFT OUTER JOIN key_description k7 ON k7.description = 'Vorlaufsolltemperatur' LEFT OUTER JOIN log_details d7 ON l.id = d7.fk_id AND d7.fk_keyid = k7.keyid -- Order is relevant here LEFT OUTER JOIN key_description k8 ON k8.description = 'Vorlauftemperatur' LEFT OUTER JOIN log_details d8 ON l.id = d8.fk_id AND d8.fk_keyid = k8.keyid -- Order is relevant here LEFT OUTER JOIN key_description k9 ON k9.description = 'Aussentemperatur' LEFT OUTER JOIN log_details d9 ON l.id = d9.fk_id AND d9.fk_keyid = k9.keyid -- Order is relevant here LEFT OUTER JOIN key_description k10 ON k10.description = 'Brenner' LEFT OUTER JOIN log_details d10 ON l.id = d10.fk_id AND d10.fk_keyid = k10.keyid -- Order is relevant here LEFT OUTER JOIN key_description k11 ON k11.description = 'Heizkreispumpe' LEFT OUTER JOIN log_details d11 ON l.id = d11.fk_id AND d11.fk_keyid = k11.keyid -- Order is relevant here LEFT OUTER JOIN key_description k12 ON k12.description = 'Speicherladepumpe' LEFT OUTER JOIN log_details d12 ON l.id = d12.fk_id AND d12.fk_keyid = k12.keyid -- Order is relevant here LEFT OUTER JOIN key_description k13 ON k13.description = 'Mischer auf' LEFT OUTER JOIN log_details d13 ON l.id = d13.fk_id AND d13.fk_keyid = k13.keyid -- Order is relevant here LEFT OUTER JOIN key_description k14 ON k14.description = 'Mischer zu' LEFT OUTER JOIN log_details d14 ON l.id = d14.fk_id AND d14.fk_keyid = k14.keyid -- Order is relevant here LEFT OUTER JOIN key_description k15 ON k15.description = 'Heizkreis Status Bedien' LEFT OUTER JOIN log_details d15 ON l.id = d15.fk_id AND d15.fk_keyid = k15.keyid -- Order is relevant here LEFT OUTER JOIN key_description k16 ON k16.description = 'Speicher Status Bedien' LEFT OUTER JOIN log_details d16 ON l.id = d16.fk_id AND d16.fk_keyid = k16.keyid -- Order is relevant here LEFT OUTER JOIN key_description k17 ON k17.description = 'Heizkreis Status Kessel' LEFT OUTER JOIN log_details d17 ON l.id = d17.fk_id AND d17.fk_keyid = k17.keyid -- Order is relevant here LEFT OUTER JOIN key_description k18 ON k18.description = 'Speicher Status Kessel' LEFT OUTER JOIN log_details d18 ON l.id = d18.fk_id AND d18.fk_keyid = k18.keyid -- Order is relevant here LEFT OUTER JOIN key_description k19 ON k19.description = 'Programmschalterstellung Bedien' LEFT OUTER JOIN log_details d19 ON l.id = d19.fk_id AND d19.fk_keyid = k19.keyid -- Order is relevant here LEFT OUTER JOIN key_description k20 ON k20.description = 'Programmschalterstellung Kessel' LEFT OUTER JOIN log_details d20 ON l.id = d20.fk_id AND d20.fk_keyid = k20.keyid WHERE datetime >= '1970-01-01 00:00:00+02' AND datetime < '1970-01-02 00:00:00+02' ORDER BY datetime DESC ; PLan 1: Limit (cost=0.00..0.13 rows=1 width=8) -> Index Scan Backward using i_log_unique on log (cost=0.00..12111.49 rows=90671 width=8) Index Cond: ((datetime >= '1969-12-31 23:00:00+01'::timestamp with time zone) AND (datetime < '1970-01-01 23:00:00+01'::timestamp with time zone)) Plan 2: Sort (cost=33845899.27..33846125.95 rows=90671 width=192) Sort Key: l.datetime -> Merge Left Join (cost=32273963.28..33838433.26 rows=90671 width=192) Merge Cond: (l.id = d20.fk_id) Join Filter: (d20.fk_keyid = k20.keyid) -> Nested Loop Left Join (cost=30660266.39..32149359.92 rows=90671 width=192) -> Merge Left Join (cost=30660265.12..32147545.23 rows=90671 width=184) Merge Cond: (l.id = d19.fk_id) Join Filter: (d19.fk_keyid = k19.keyid) -> Nested Loop Left Join (cost=29046568.23..30458471.89 rows=90671 width=184) -> Merge Left Join (cost=29046566.95..30456657.20 rows=90671 width=176) Merge Cond: (l.id = d18.fk_id) Join Filter: (d18.fk_keyid = k18.keyid) -> Nested Loop Left Join (cost=27432870.07..28767583.86 rows=90671 width=176) -> Merge Left Join (cost=27432868.79..28765769.16 rows=90671 width=168) Merge Cond: (l.id = d17.fk_id) Join Filter: (d17.fk_keyid = k17.keyid) -> Nested Loop Left Join (cost=25819171.90..27076695.83 rows=90671 width=168) -> Merge Left Join (cost=25819170.63..27074881.13 rows=90671 width=160) Merge Cond: (l.id = d16.fk_id) Join Filter: (d16.fk_keyid = k16.keyid) -> Nested Loop Left Join (cost=24205473.74..25385807.80 rows=90671 width=160) -> Merge Left Join (cost=24205472.46..25383993.10 rows=90671 width=152) Merge Cond: (l.id = d15.fk_id) Join Filter: (d15.fk_keyid = k15.keyid) -> Nested Loop Left Join (cost=22591775.57..23694919.77 rows=90671 width=152) -> Merge Left Join (cost=22591774.30..23693105.07 rows=90671 width=144) Merge Cond: (l.id = d14.fk_id) Join Filter: (d14.fk_keyid = k14.keyid) -> Nested Loop Left Join (cost=20978077.41..22004031.73 rows=90671 width=144) -> Merge Left Join (cost=20978076.13..22002217.04 rows=90671 width=136) Merge Cond: (l.id = d13.fk_id) Join Filter: (d13.fk_keyid = k13.keyid) -> Nested Loop Left Join (cost=19364379.25..20313143.70 rows=90671 width=136) -> Merge Left Join (cost=19364377.97..20311329.01 rows=90671 width=128) Merge Cond: (l.id = d12.fk_id) Join Filter: (d12.fk_keyid = k12.keyid) -> Nested Loop Left Join (cost=17750681.08..18622255.67 rows=90671 width=128) -> Merge Left Join (cost=17750679.81..18620440.98 rows=90671 width=120) Merge Cond: (l.id = d11.fk_id) Join Filter: (d11.fk_keyid = k11.keyid) -> Nested Loop Left Join (cost=16136982.92..16931367.64 rows=90671 width=120) -> Merge Left Join (cost=16136981.64..16929552.94 rows=90671 width=112) Merge Cond: (l.id = d10.fk_id) Join Filter: (d10.fk_keyid = k10.keyid) -> Nested Loop Left Join (cost=14523284.75..15240479.61 rows=90671 width=112) -> Merge Left Join (cost=14523283.48..15238664.91 rows=90671 width=104) Merge Cond: (l.id = d9.fk_id) Join Filter: (d9.fk_keyid = k9.keyid) -> Nested Loop Left Join (cost=12909586.59..13549591.58 rows=90671 width=104) -> Merge Left Join (cost=12909585.31..13547776.88 rows=90671 width=96) Merge Cond: (l.id = d8.fk_id) Join Filter: (d8.fk_keyid = k8.keyid) -> Nested Loop Left Join (cost=11295888.42..11858703.54 rows=90671 width=96) -> Merge Left Join (cost=11295887.15..11856888.85 rows=90671 width=88) Merge Cond: (l.id = d7.fk_id) Join Filter: (d7.fk_keyid = k7.keyid) -> Nested Loop Left Join (cost=9682190.26..10167815.51 rows=90671 width=88) -> Merge Left Join (cost=9682188.98..10166000.82 rows=90671 width=80) Merge Cond: (l.id = d6.fk_id) Join Filter: (d6.fk_keyid = k6.keyid) -> Nested Loop Left Join (cost=8068492.10..8476927.48 rows=90671 width=80) -> Merge Left Join (cost=8068490.82..8475112.79 rows=90671 width=72) Merge Cond: (l.id = d5.fk_id) Join Filter: (d5.fk_keyid = k5.keyid) -> Nested Loop Left Join (cost=6454793.93..6786039.45 rows=90671 width=72) -> Merge Left Join (cost=6454792.66..6784224.75 rows=90671 width=64) Merge Cond: (l.id = d4.fk_id) Join Filter: (d4.fk_keyid = k4.keyid) -> Nested Loop Left Join (cost=4841095.77..5095151.42 rows=90671 width=64) -> Merge Left Join (cost=4841094.49..5093336.72 rows=90671 width=56) Merge Cond: (l.id = d3.fk_id) Join Filter: (d3.fk_keyid = k3.keyid) -> Nested Loop Left Join (cost=3227397.60..3404263.39 rows=90671 width=56) -> Merge Left Join (cost=3227396.33..3402448.69 rows=90671 width=48) Merge Cond: (l.id = d2.fk_id) Join Filter: (d2.fk_keyid = k2.keyid) -> Nested Loop Left Join (cost=1613699.44..1713375.36 rows=90671 width=48) -> Merge Left Join (cost=1613698.16..1711560.66 rows=90671 width=40) Merge Cond: (l.id = d1.fk_id) Join Filter: (d1.fk_keyid = k1.keyid) -> Nested Loop Left Join (cost=1.28..22487.32 rows=90671 width=40) -> Index Scan using log_pkey on log l (cost=0.00..20672.63 rows=90671 width=32) Filter: ((datetime >= '1969-12-31 23:00:00+01'::timestamp with time zone) AND (datetime < '1970-01-01 23:00:00+01'::timestamp with time zone)) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k1 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Raumsolltemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d1.fk_id -> Seq Scan on log_details d1 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k2 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Raumtemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d2.fk_id -> Seq Scan on log_details d2 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k3 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Kesselsolltemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d3.fk_id -> Seq Scan on log_details d3 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k4 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Kesseltemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d4.fk_id -> Seq Scan on log_details d4 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k5 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Speichersolltemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d5.fk_id -> Seq Scan on log_details d5 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k6 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Speichertemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d6.fk_id -> Seq Scan on log_details d6 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k7 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Vorlaufsolltemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d7.fk_id -> Seq Scan on log_details d7 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k8 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Vorlauftemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d8.fk_id -> Seq Scan on log_details d8 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k9 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Aussentemperatur'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d9.fk_id -> Seq Scan on log_details d9 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k10 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Brenner'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d10.fk_id -> Seq Scan on log_details d10 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k11 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Heizkreispumpe'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d11.fk_id -> Seq Scan on log_details d11 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k12 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Speicherladepumpe'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d12.fk_id -> Seq Scan on log_details d12 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k13 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Mischer auf'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d13.fk_id -> Seq Scan on log_details d13 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k14 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Mischer zu'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d14.fk_id -> Seq Scan on log_details d14 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k15 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Heizkreis Status Bedien'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d15.fk_id -> Seq Scan on log_details d15 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k16 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Speicher Status Bedien'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d16.fk_id -> Seq Scan on log_details d16 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k17 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Heizkreis Status Kessel'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d17.fk_id -> Seq Scan on log_details d17 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k18 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Speicher Status Kessel'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d18.fk_id -> Seq Scan on log_details d18 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k19 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Programmschalterstellung Bedien'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d19.fk_id -> Seq Scan on log_details d19 (cost=0.00..172081.20 rows=10512320 width=24) -> Materialize (cost=1.28..1.29 rows=1 width=8) -> Seq Scan on key_description k20 (cost=0.00..1.27 rows=1 width=8) Filter: ((description)::text = 'Programmschalterstellung Kessel'::text) -> Materialize (cost=1613696.89..1745100.89 rows=10512320 width=24) -> Sort (cost=1613696.89..1639977.69 rows=10512320 width=24) Sort Key: d20.fk_id -> Seq Scan on log_details d20 (cost=0.00..172081.20 rows=10512320 width=24)