PgHero

Queries

Total Time Average Time Calls
12,678 min 85% 6,162 ms 123,444 sickadmin
SELECT To_Char(Min("DeviceDtm"), $1) as "DeviceDtm" FROM "CpcbSyncTracker" WHERE "Uploaded" = $2 AND "DeviceDtm" < now()::timestamp - INTERVAL $3
Covered by index on (DeviceDtm)
Rows: 7748079
Row progression: 7748079, 774827

Row estimates
- DeviceDtm (<): 774827
- Uploaded (=): 3874040

Existing indexes
- DeviceId, RegisterId, DeviceDtm PRIMARY
- DeviceDtm
843 min 6% 2,296 ms 22,022 sickadmin
UPDATE "SpcbSyncTracker" SET "Uploaded" = $1, "UploadedDtm" = date_trunc($2, now()::timestamp) WHERE "DeviceId" IN (SELECT "DeviceId" From "PcbDevice" WHERE "SpcbDeviceCode" = $3) AND time_bucket($4, "DeviceDtm") + $5 = ($6::timestamp)
494 min 3% 220 ms 134,567 sickadmin
COPY "RegisterDataSync" ("DeviceId", "RegisterId", "DeviceDtm", "RegisterValue", "NormalizedValue", "ServerDtm", "Quality") FROM STDIN (FORMAT BINARY)
313 min 2% 18,517 ms 1,014 sickadmin
select "DeviceDtm", ((dc."DisplayName") || $1 || "ParameterName") as "StationParameter", ((s."StationName") || $2 || "ParameterName") as "ParameterName", rm."HighStdLimit", "NormalizedValue" FROM registerdatapast7days rd INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId" INNER JOIN "Station" s ON dc."StationId" = s."StationId" AND s."MonitoringType" = $3 INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId" WHERE rm."ELV" > $4 AND rd."NormalizedValue" > rm."ELV" Order By 1, 2
250 min 2% 3,193 ms 4,697 sickadmin
SELECT cl."LocationId", cl."SpcbIndustryCode", dc."StationId", cs."SpcbStationCode", rd."DeviceId", COALESCE(cp."SpcbAltDeviceCode", cd."SpcbDeviceCode") as "SpcbDeviceCode", rd."RegisterId", cp."SpcbParameterCode", cp."SpcbUnit", time_bucket($1, rd."DeviceDtm") + $2 as "DeviceDtm", round(avg(COALESCE(cast("RegisterValue" as numeric), $3)), $4) as "RegisterValue", round(avg(COALESCE(cast("NormalizedValue" as numeric), $5)), $6) as "NormalizedValue", last("Quality", rd."DeviceDtm") as "Quality" FROM "SpcbSyncTracker" rd INNER JOIN "PcbParameter" cp ON cp."RegisterId" = rd."RegisterId" and cp."SpcbPrmIsActive" = $7 INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId" AND dc."DeviceState" >= $8 INNER JOIN "PcbDevice" cd ON cd."DeviceId" = rd."DeviceId" and cd."SpcbDevIsActive" = $9 INNER JOIN "Station" s ON dc."StationId" = s."StationId" INNER JOIN "PcbStation" cs ON cs."StationId" = dc."StationId" and cs."SpcbStnIsActive" = $10 INNER JOIN "PcbLocation" cl ON s."LocationId" = cl."LocationId" and cl."SpcbIndIsActive" = $11 WHERE time_bucket($12, rd."DeviceDtm") + $13 = ($14::timestamp) GROUP BY cl."LocationId", cl."SpcbIndustryCode", dc."StationId", cs."SpcbStationCode", rd."DeviceId", cd."SpcbDeviceCode", cp."SpcbAltDeviceCode", rd."RegisterId", cp."SpcbParameterCode", cp."SpcbUnit", (time_bucket('15 minute', rd."DeviceDtm")) ORDER BY cs."SpcbStationCode", cd."SpcbDeviceCode", cp."SpcbParameterCode", (time_bucket($15, rd."DeviceDtm"))
58 min 0.4% 0 ms 27,914,483 sickadmin
UPDATE "DeviceState" SET "DeviceStatus" = $1, "LastConnStatus" = $2, "ConnDesc" = $3 WHERE "DeviceId" = $4
40 min 0.3% 32 ms 75,423 sickadmin
UPDATE "CpcbSyncTracker" SET "Uploaded" = $1, "UploadedDtm" = date_trunc($2, now()::timestamp) WHERE "DeviceDtm" = ($3::timestamp)
Covered by index on (DeviceDtm)
Rows: 7748079
Row progression: 7748079, 187

Row estimates
- DeviceDtm (=): 187

Existing indexes
- DeviceId, RegisterId, DeviceDtm PRIMARY
- DeviceDtm
35 min 0.2% 0 ms 15,725,670 sickadmin
INSERT INTO "CpcbSyncTracker" ("DeviceId", "RegisterId", "DeviceDtm", "RegisterValue", "NormalizedValue", "ServerDtm", "Quality")
			VALUES (new."DeviceId", new."RegisterId", new."DeviceDtm", new."RegisterValue", new."NormalizedValue", new."ServerDtm", new."Quality")
32 min 0.2% 0 ms 15,725,670 sickadmin
INSERT INTO "SpcbSyncTracker" ("DeviceId", "RegisterId", "DeviceDtm", "RegisterValue", "NormalizedValue", "ServerDtm", "Quality")
			VALUES (new."DeviceId", new."RegisterId", new."DeviceDtm", new."RegisterValue", new."NormalizedValue", new."ServerDtm", new."Quality")
22 min 0.1% 1,132 ms 1,181 sickadmin
select rd."DeviceId", rd."RegisterId", "ParameterName", u."UnitName", rd."DeviceDtm" as "DeviceDtm", dc."StationId", s."StationName",s."MonitoringType", COALESCE(round(nullif(cast (rd."NormalizedValue" as numeric), $1), $2), $3) as "RegisterValue", "Quality", me."MiscKey" as "QualityDesc",Now() as "ServerDtm", "ParameterDesc", rm."UnitId", "RegisterAddr", "ReadRegisterLen", rm."HighStdLimit", rm."LowStdLimit", rm."ELV"   FROM "RegisterData" rd  INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId"  INNER JOIN "Station" s ON dc."StationId" = s."StationId"  INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  INNER JOIN "MiscEnum" me ON rd."Quality" = me."MiscValue" and me."MiscTag" = $4  WHERE rd."DeviceDtm" >= ($5::timestamp)  AND rd."DeviceDtm" < ($6::timestamp)  AND dc."StationId" = $7 Order By rd."DeviceId", rm."ReadOrder", rd."DeviceDtm"
21 min 0.1% 0 ms 15,819,568 sickadmin
INSERT INTO "RegisterData" ("DeviceId", "RegisterId", "DeviceDtm", "RegisterValue", "NormalizedValue", "ServerDtm", "Quality")
		VALUES (new."DeviceId", new."RegisterId", new."DeviceDtm", new."RegisterValue", new."NormalizedValue", new."ServerDtm", new."Quality")
20 min 0.1% 0 ms 15,819,926 sickadmin
DELETE FROM "RegisterDataSync" WHERE "DeviceId"=new."DeviceId" AND "RegisterId"=new."RegisterId" AND "DeviceDtm"=new."DeviceDtm"
16 min 0.1% 0 ms 15,819,931 sickadmin
(SELECT COUNT(*) FROM "RegisterData" WHERE "DeviceId"=new."DeviceId" AND "RegisterId"=new."RegisterId" AND "DeviceDtm"=new."DeviceDtm")=$17
16 min 0.1% 193 ms 4,921 sickadmin
select jinfo->>$1 as nextcpcbsync,jinfo->>$2 as nextspcbsync, (select "DeviceDtm" from "RegisterData" ORDER BY "DeviceDtm" DESC LIMIT $3) as datasyncdatetime, (select COUNT(*) from "RegisterData" where "DeviceDtm" = (select d."DeviceDtm" from "RegisterData" d ORDER BY d."DeviceDtm" DESC LIMIT $4)) as noofregisterssynced FROM "SyncState"
10 min < 0.1% 132 ms 4,350 sickadmin
SELECT schemaname AS schema, t.relname AS table, ix.relname AS name, regexp_replace(pg_get_indexdef(i.indexrelid), $1, $2) AS columns, regexp_replace(pg_get_indexdef(i.indexrelid), $3, $4) AS using, indisunique AS unique, indisprimary AS primary, indisvalid AS valid, indexprs::text, indpred::text, pg_get_indexdef(i.indexrelid) AS definition FROM pg_index i INNER JOIN pg_class t ON t.oid = i.indrelid INNER JOIN pg_class ix ON ix.oid = i.indexrelid LEFT JOIN pg_stat_user_indexes ui ON ui.indexrelid = i.indexrelid WHERE schemaname IS NOT NULL ORDER BY 1, 2 /*pghero*/
8 min < 0.1% 3 ms 149,279 sickadmin
SELECT * FROM "DeviceState"
6 min < 0.1% 1 ms 250,903 sickadmin
SELECT cl."LocationId", cl."CpcbIndustryCode", dc."StationId", cs."CpcbStationCode", rd."DeviceId", COALESCE(cp."CpcbAltDeviceCode", cd."CpcbDeviceCode") as "CpcbDeviceCode", rd."RegisterId", cp."CpcbParameterCode", cp."CpcbUnit", rd."DeviceDtm", round(cast("NormalizedValue" as numeric), $1) as "NormalizedValue", rd."Quality" FROM "CpcbSyncTracker" rd INNER JOIN "PcbParameter" cp ON cp."RegisterId" = rd."RegisterId" and cp."CpcbPrmIsActive" = $2 INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId" AND dc."DeviceState" >= $3 INNER JOIN "PcbDevice" cd ON cd."DeviceId" = rd."DeviceId" and cd."CpcbDevIsActive" = $4 INNER JOIN "Station" s ON dc."StationId" = s."StationId" INNER JOIN "PcbStation" cs ON cs."StationId" = dc."StationId" and cs."CpcbStnIsActive" = $5 INNER JOIN "PcbLocation" cl ON s."LocationId" = cl."LocationId" and cl."CpcbIndIsActive" = $6 WHERE rd."DeviceDtm" = ($7::timestamp) AND rd."Uploaded" = $8 ORDER BY cs."CpcbStationCode", cd."CpcbDeviceCode", cp."CpcbParameterCode"
4 min < 0.1% 147 ms 1,603 sickadmin
SELECT l."LocationId", l."LocationDisplayName", ic."IndustryCategoryName", s."StationId", s."StationDisplayName", 
dc."DisplayName" as "DeviceDisplayName", rm."ParameterName", u."UnitName", 
time_bucket($1, rd."DeviceDtm") +  interval $2  AS "Norm15MinDtm", 
MAX("ELV") as "ELV", ROUND(MAX("ELV" * $3 / $4)) as "LSL", ROUND(MAX("ELV" * $5 / $6)) as "USL", 
ROUND(AVG(COALESCE(rd."NormalizedValue", $7)), $8) AS "NormalizedValue", MAX(rd."Quality") AS "Quality" 
FROM "RegisterData" rd 
INNER JOIN "RegisterMap" rm on rd."DeviceId" = rm."DeviceId" And rd."RegisterId" = rm."RegisterId" 
INNER JOIN "DeviceConfig" dc on rd."DeviceId" = dc."DeviceId" 
INNER JOIN "Station" s on dc."StationId" = s."StationId" And s."MonitoringType" = $9 
INNER JOIN "Unit" u on u."UnitId" = rm."UnitId" 
INNER JOIN "Location" l on s."LocationId" = l."LocationId" And l."LocationCode" = $10 
LEFT JOIN "IndustryCategory" ic on l."IndustryCategoryId" = ic."IndustryCategoryId" 
WHERE rd."DeviceDtm" >= $11::timestamp AND rd."DeviceDtm" < $12::timestamp AND rm."ELV" > $13 
AND "Quality" = $14 
GROUP BY l."LocationId", l."LocationDisplayName", ic."IndustryCategoryName", s."StationId", s."StationDisplayName", 
"DeviceDisplayName", rm."ParameterName", u."UnitName", time_bucket($15, rd."DeviceDtm")  
HAVING AVG(COALESCE(rd."NormalizedValue", $16)) > MAX(rm."ELV")
3 min < 0.1% 16 ms 10,964 sickadmin
SELECT ns.nspname, t.oid, t.typname, t.typtype, t.typnotnull, t.elemtypoid
FROM (
    -- Arrays have typtype=b - this subquery identifies them by their typreceive and converts their typtype to a
    -- We first do this for the type (innerest-most subquery), and then for its element type
    -- This also returns the array element, range subtype and domain base type as elemtypoid
    SELECT
        typ.oid, typ.typnamespace, typ.typname, typ.typtype, typ.typrelid, typ.typnotnull, typ.relkind,
        elemtyp.oid AS elemtypoid, elemtyp.typname AS elemtypname, elemcls.relkind AS elemrelkind,
        CASE WHEN elemproc.proname=$1 THEN $2 ELSE elemtyp.typtype END AS elemtyptype
    FROM (
        SELECT typ.oid, typnamespace, typname, typrelid, typnotnull, relkind, typelem AS elemoid,
            CASE WHEN proc.proname=$3 THEN $4 ELSE typ.typtype END AS typtype,
            CASE
                WHEN proc.proname=$5 THEN typ.typelem
                WHEN typ.typtype=$6 THEN rngsubtype
                WHEN typ.typtype=$7 THEN (SELECT rngtypid FROM pg_range WHERE rngmultitypid = typ.oid)
                WHEN typ.typtype=$8 THEN typ.typbasetype
            END AS elemtypoid
        FROM pg_type AS typ
        LEFT JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
        LEFT JOIN pg_proc AS proc ON proc.oid = typ.typreceive
        LEFT JOIN pg_range ON (pg_range.rngtypid = typ.oid)
    ) AS typ
    LEFT JOIN pg_type AS elemtyp ON elemtyp.oid = elemtypoid
    LEFT JOIN pg_class AS elemcls ON (elemcls.oid = elemtyp.typrelid)
    LEFT JOIN pg_proc AS elemproc ON elemproc.oid = elemtyp.typreceive
) AS t
JOIN pg_namespace AS ns ON (ns.oid = typnamespace)
WHERE
    typtype IN ($9, $10, $11, $12, $13) OR -- Base, range, multirange, enum, domain
    (typtype = $14 AND relkind=$15) OR -- User-defined free-standing composites (not table composites) by default
    (typtype = $16 AND typname IN ($17, $18)) OR -- Some special supported pseudo-types
    (typtype = $19 AND (  -- Array of...
        elemtyptype IN ($20, $21, $22, $23, $24) OR -- Array of base, range, multirange, enum, domain
        (elemtyptype = $25 AND elemtypname IN ($26, $27)) OR -- Arrays of special supported pseudo-types
        (elemtyptype = $28 AND elemrelkind=$29) -- Array of user-defined free-standing composites (not table composites) by default
    ))
ORDER BY CASE
       WHEN typtype IN ($30, $31, $32) THEN $33           -- First base types, enums, pseudo-types
       WHEN typtype = $34 THEN $35                        -- Ranges after
       WHEN typtype = $36 THEN $37                        -- Multiranges after
       WHEN typtype = $38 THEN $39                        -- Composites after
       WHEN typtype = $40 AND elemtyptype <> $41 THEN $42 -- Domains over non-arrays after
       WHEN typtype = $43 THEN $44                        -- Arrays after
       WHEN typtype = $45 AND elemtyptype = $46 THEN $47  -- Domains over arrays last
END
2 min < 0.1% 1 ms 123,444 sickadmin
UPDATE "CpcbSyncTracker" SET "Uploaded" = $1, "UploadedDtm" = date_trunc($2, now()::timestamp) WHERE "Uploaded" = $3 AND "DeviceDtm" = ($4::timestamp)
Covered by index on (DeviceDtm)
Rows: 7748079
Row progression: 7748079, 187, 93

Row estimates
- DeviceDtm (=): 187
- Uploaded (=): 3874040

Existing indexes
- DeviceId, RegisterId, DeviceDtm PRIMARY
- DeviceDtm
2 min < 0.1% 26 ms 4,339 sickadmin
WITH query_stats AS ( SELECT LEFT(query, $1) AS query, queryid AS query_hash, rolname AS user, ((total_plan_time + total_exec_time) / $2 / $3) AS total_minutes, ((total_plan_time + total_exec_time) / calls) AS average_time, calls FROM pg_stat_statements INNER JOIN pg_database ON pg_database.oid = pg_stat_statements.dbid INNER JOIN pg_roles ON pg_roles.oid = pg_stat_statements.userid WHERE calls > $4 AND pg_database.datname = current_database() ) SELECT query, query AS explainable_query, query_hash, query_stats.user, total_minutes, average_time, calls, total_minutes * $5 / (SELECT SUM(total_minutes) FROM query_stats) AS total_percent, (SELECT SUM(total_minutes) FROM query_stats) AS all_queries_total_minutes FROM query_stats ORDER BY "total_minutes" DESC LIMIT $6 /*pghero*/
2 min < 0.1% 25 ms 4,305 sickadmin
SELECT n.nspname AS table_schema, c.relname AS table, attname AS column, format_type(a.atttypid, a.atttypmod) AS column_type, pg_get_expr(d.adbin, d.adrelid) AS default_value FROM pg_catalog.pg_attribute a INNER JOIN pg_catalog.pg_class c ON c.oid = a.attrelid INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace INNER JOIN pg_catalog.pg_attrdef d ON (a.attrelid, a.attnum) = (d.adrelid, d.adnum) WHERE NOT a.attisdropped AND a.attnum > $1 AND pg_get_expr(d.adbin, d.adrelid) LIKE $2 AND n.nspname NOT LIKE $3 /*pghero*/
2 min < 0.1% 9,448 ms 11 sickadmin
select g."Date" + INTERVAL $1 as "Date",g."PM" from (select * from crosstab ($2, $3) as ct ("Date" timestamp , "PM" decimal) order by "Date" asc) as g
2 min < 0.1% 9,421 ms 11 sickadmin
select * from crosstab ($1, $2) as ct ("Date" timestamp , "PM" decimal) left join lateral(
select * from crosstab 
($3, $4) as ct ("QDate" timestamp ,"QPM" decimal)) q on ct."Date" = q."QDate"
order by ct."Date" asc
2 min < 0.1% 9,370 ms 11 sickadmin
select time_bucket_gapfill($1, "DeviceDtm") as "DeviceDtm", "ParameterName", CASE WHEN Max("Quality") = $2 THEN $3 WHEN Max("Quality") = $4 THEN $5 ELSE round(avg(nullif(cast ("NormalizedValue" as numeric), $6)), $7) END as "RegisterValue"  FROM "RegisterData" rd  INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId"  INNER JOIN "Station" s ON dc."StationId" = s."StationId"  INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  WHERE "DeviceDtm" >= ($8::timestamp) -INTERVAL $9 AND "DeviceDtm" < ($10::timestamp)  AND dc."StationId" = $11 AND "ParameterName" IN ($12) Group By 1, 2 Order By 1, 2
1 min < 0.1% 41 ms 1,903 sickadmin
SELECT ns.nspname, t.oid, t.typname, t.typtype, t.typnotnull, t.elemtypoid
FROM (
    -- Arrays have typtype=b - this subquery identifies them by their typreceive and converts their typtype to a
    -- We first do this for the type (innerest-most subquery), and then for its element type
    -- This also returns the array element, range subtype and domain base type as elemtypoid
    SELECT
        typ.oid, typ.typnamespace, typ.typname, typ.typtype, typ.typrelid, typ.typnotnull, typ.relkind,
        elemtyp.oid AS elemtypoid, elemtyp.typname AS elemtypname, elemcls.relkind AS elemrelkind,
        CASE WHEN elemproc.proname=$1 THEN $2 ELSE elemtyp.typtype END AS elemtyptype
    FROM (
        SELECT typ.oid, typnamespace, typname, typrelid, typnotnull, relkind, typelem AS elemoid,
            CASE WHEN proc.proname=$3 THEN $4 ELSE typ.typtype END AS typtype,
            CASE
                WHEN proc.proname=$5 THEN typ.typelem
                WHEN typ.typtype=$6 THEN rngsubtype
                WHEN typ.typtype=$7 THEN (SELECT rngtypid FROM pg_range WHERE rngmultitypid = typ.oid)
                WHEN typ.typtype=$8 THEN typ.typbasetype
            END AS elemtypoid
        FROM pg_type AS typ
        LEFT JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
        LEFT JOIN pg_proc AS proc ON proc.oid = typ.typreceive
        LEFT JOIN pg_range ON (pg_range.rngtypid = typ.oid)
    ) AS typ
    LEFT JOIN pg_type AS elemtyp ON elemtyp.oid = elemtypoid
    LEFT JOIN pg_class AS elemcls ON (elemcls.oid = elemtyp.typrelid)
    LEFT JOIN pg_proc AS elemproc ON elemproc.oid = elemtyp.typreceive
) AS t
JOIN pg_namespace AS ns ON (ns.oid = typnamespace)
WHERE
    typtype IN ($9, $10, $11, $12, $13) OR -- Base, range, multirange, enum, domain
    (typtype = $14 AND relkind=$15) OR -- User-defined free-standing composites (not table composites) by default
    (typtype = $16 AND typname IN ($17, $18, $19)) OR -- Some special supported pseudo-types
    (typtype = $20 AND (  -- Array of...
        elemtyptype IN ($21, $22, $23, $24, $25) OR -- Array of base, range, multirange, enum, domain
        (elemtyptype = $26 AND elemtypname IN ($27, $28)) OR -- Arrays of special supported pseudo-types
        (elemtyptype = $29 AND elemrelkind=$30) -- Array of user-defined free-standing composites (not table composites) by default
    ))
ORDER BY CASE
       WHEN typtype IN ($31, $32, $33) THEN $34           -- First base types, enums, pseudo-types
       WHEN typtype = $35 THEN $36                        -- Composites after (fields loaded later in 2nd pass)
       WHEN typtype = $37 THEN $38                        -- Ranges after
       WHEN typtype = $39 THEN $40                        -- Multiranges after
       WHEN typtype = $41 AND elemtyptype <> $42 THEN $43 -- Domains over non-arrays after
       WHEN typtype = $44 THEN $45                        -- Arrays after
       WHEN typtype = $46 AND elemtyptype = $47 THEN $48  -- Domains over arrays last
END
1 min < 0.1% 14,252 ms 4 sickadmin
UPDATE "SpcbSyncTracker" SET "Uploaded" = $1, "UploadedDtm" = date_trunc($2, now()::timestamp) WHERE time_bucket($3, "DeviceDtm") + $4 = ($5::timestamp)
1 min < 0.1% 5,091 ms 11 sickadmin
select time_bucket_gapfill($1, "DeviceDtm") as "DeviceDtm", "ParameterName", round(avg(nullif(cast ("NormalizedValue" as numeric), $2)), $3)  as "RegisterValue"  FROM "RegisterData" rd  INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId"  INNER JOIN "Station" s ON dc."StationId" = s."StationId"  INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  WHERE "DeviceDtm" >= ($4::timestamp)  AND "DeviceDtm" <= ($5::timestamp)  AND dc."StationId" = $6 AND "ParameterName" IN ($7) Group By 1, 2 Order By 1, 2
1 min < 0.1% 4,259 ms 11 sickadmin
select time_bucket_gapfill($1, "DeviceDtm") as "DeviceDtm", "ParameterName", max("Quality") as "Quality" FROM "RegisterData" rd  
   INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId" 
    INNER JOIN "Station" s ON dc."StationId" = s."StationId"  
    INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  
   INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  WHERE "DeviceDtm" >= ($2::timestamp) 
    AND "DeviceDtm" <= ($3::timestamp)  AND dc."StationId" = $4 AND "ParameterName" 
    IN ($5) Group By 1, 2 Order By 1, 2
1 min < 0.1% 2,382 ms 18 sickadmin
select "DeviceDtm"+INTERVAL $1 as "DeviceDtm", ((s."StationName"  || $2 || "ParameterName")::text) as "StationParameter", CASE WHEN "Quality" = $3 THEN $4 ELSE COALESCE(round(nullif(cast ("NormalizedValue" as numeric), $5), $6), $7) END as "RegisterValue" FROM registerdata_15min rd INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId" INNER JOIN "Station" s ON dc."StationId" = s."StationId" INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId" INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId" WHERE rd."DeviceDtm" >= ($8::timestamp)-INTERVAL $9 AND rd."DeviceDtm" < ($10::timestamp)  AND "ParameterName" IN ($11) Order By 1, 2
1 min < 0.1% 3 ms 12,968 sickadmin
-- Load field definitions for (free-standing) composite types
SELECT typ.oid, att.attname, att.atttypid
FROM pg_type AS typ
JOIN pg_namespace AS ns ON (ns.oid = typ.typnamespace)
JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
JOIN pg_attribute AS att ON (att.attrelid = typ.typrelid)
WHERE
  (typ.typtype = $1 AND cls.relkind=$2) AND
  attnum > $3 AND     -- Don't load system attributes
  NOT attisdropped
ORDER BY typ.oid, att.attnum
0 min < 0.1% 0 ms 1,364,374 sickadmin
DISCARD ALL
0 min < 0.1% 0 ms 80,037 sickadmin
UPDATE "SyncState" SET  jinfo = jsonb_set(jinfo, $1, $2::jsonb) WHERE id = $3
0 min < 0.1% 3 ms 7,090 sickadmin
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
  t.typname IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40)
0 min < 0.1% 2,924 ms 6 sickadmin
select * from crosstab ($1, $2) as ct ("Date" timestamp , "AAQMS#01-WPFA SO2" decimal,"AAQMS#02-CRM SO2" decimal,"AAQMS#03-PH#03 SO2" decimal,"AAQMS#04-PH#06 SO2" decimal,"Stack_11_Coke Plant Battery 11 Process SO2" decimal,"Stack_13_Sinter Plant-1 Waste Gas SO2" decimal,"Stack_15_Sinter Plant # 2 Waste Gas SO2" decimal,"Stack_18_Sinter Plant # 3Combined(Waste Gas&Dedusting) SO2" decimal,"Stack_1_Power House-3 & Boiler-07&08 SO2" decimal,"Stack_20_Sinter Plant#04-Combined(Waste Gas&Dedusting) SO2" decimal,"Stack_24_H-Blast Furnace Stove SO2" decimal,"Stack_2_Power House-4-Boiler-4 SO2" decimal,"Stack_55_I-Blast Furnance-Stove SO2" decimal,"Stack_6_Coke Plant Battery#07 SO2" decimal,"Stack_73_Power House-5-Boiler-A SO2" decimal,"Stack_74_Power House-5-Boiler-B&C SO2" decimal,"Stack_7_Coke Plant Battery#08 SO2" decimal,"Stack_80_C_Blast_Furnace_Stove SO2" decimal,"Stack_81_E_Blast_Furnace_Stove SO2" decimal,"Stack_82_F_Blast_Furnace_Stove SO2" decimal,"Stack_83_G_Blast_Furnace_Stove SO2" decimal,"Stack_84_Power_House_4_Boiler_1&2 SO2" decimal,"Stack_85_Power_House_4_Boiler_5 SO2" decimal,"Stack_86_Power_House_3_Boiler_5 SO2" decimal,"Stack_87_Power_House_3_Boiler_6 SO2" decimal,"Stack_8_Coke Plant Battery#09 SO2" decimal,"Stack_9_Coke Plant Battery 10 Process SO2" decimal) order by "Date" asc
0 min < 0.1% 4 ms 4,305 sickadmin
SELECT n.nspname AS schema, c.relname AS table, $1 - GREATEST(AGE(c.relfrozenxid), AGE(t.relfrozenxid)) AS transactions_left FROM pg_class c INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_class t ON c.reltoastrelid = t.oid WHERE c.relkind = $2 AND ($3 - GREATEST(AGE(c.relfrozenxid), AGE(t.relfrozenxid))) < $4 ORDER BY 3, 1, 2 /*pghero*/
0 min < 0.1% 4 ms 3,462 sickadmin
select l."LocationDisplayName" as "LocationDisplayName", s."StationDisplayName" as "StationDisplayName",s."StationId", dc."DisplayName" as "DeviceId",dc."DisplayName" as "DeviceDisplayName", CASE WHEN (now() - ds."LastConnStatus"::timestamp with time zone) > $1::interval THEN $2::character varying   ELSE COALESCE(ms."MiscKey", $3::character varying) END AS "DeviceStatusString",ds."LastConnStatus" as "LastConnDtm"  from "DeviceState" ds LEFT JOIN "MiscEnum" ms ON ms."MiscTag"::text = $4::text AND ms."MiscValue" = ds."DeviceStatus"  INNER JOIN "DeviceConfig" dc ON ds."DeviceId"=dc."DeviceId" INNER JOIN "Station" s ON dc."StationId"=s."StationId"  INNER JOIN "Location" l ON s."LocationId"=l."LocationId" WHERE s."StationDisplayName" NOT LIKE $5 AND ds."ConnDesc"<>$6 AND ds."ConnDesc"<>$7
0 min < 0.1% 1,898 ms 7 sickadmin
select * from crosstab ($1, $2) as ct ("Date" timestamp , "PM10" decimal,"PM2.5" decimal,"SO2" decimal,"NOX" decimal,"CO" decimal) left join lateral(
select * from crosstab 
($3, $4) as ct ("QDate" timestamp ,"QPM10" decimal,"QPM2.5" decimal,"QSO2" decimal,"QNOX" decimal,"QCO" decimal)) q on ct."Date" = q."QDate"
order by ct."Date" asc
0 min < 0.1% 3 ms 4,305 sickadmin
SELECT pid, state, application_name AS source, age(NOW(), COALESCE(query_start, xact_start)) AS duration, (wait_event IS NOT NULL) AS waiting, query, COALESCE(query_start, xact_start) AS started_at, EXTRACT($1 FROM NOW() - COALESCE(query_start, xact_start)) * $2 AS duration_ms, usename AS user, backend_type FROM pg_stat_activity WHERE state <> $3 AND pid <> pg_backend_pid() AND datname = current_database() AND NOW() - COALESCE(query_start, xact_start) > interval $4 AND query <> $5 ORDER BY COALESCE(query_start, xact_start) DESC /*pghero*/
0 min < 0.1% 0 ms 452,665 sickadmin
SELECT * From "PcbLocation" WHERE "CpcbIndIsActive" = $1
0 min < 0.1% 1,499 ms 7 sickadmin
select g."Date" + INTERVAL $1 as "Date",g."PM10",g."PM2.5",g."SO2",g."NOX",g."CO" from (select * from crosstab ($2, $3) as ct ("Date" timestamp , "PM10" decimal,"PM2.5" decimal,"SO2" decimal,"NOX" decimal,"CO" decimal) order by "Date" asc) as g
0 min < 0.1% 0 ms 336,611 sickadmin
SELECT jinfo->>$1 as cpcbnexttime FROM "SyncState" WHERE id = $2
0 min < 0.1% 2 ms 4,305 sickadmin
SELECT state, COUNT(*) AS connections FROM pg_stat_activity GROUP BY 1 ORDER BY 2 DESC, 1 /*pghero*/
0 min < 0.1% 1 ms 7,090 sickadmin
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
  t.typtype IN ($1, $2, $3)
0 min < 0.1% 2,777 ms 3 sickadmin
select * from crosstab ($1, $2) as ct ("Date" timestamp , "Stack_15_Sinter Plant # 2 Waste Gas CO2" decimal,"Stack_18_Sinter Plant # 3Combined(Waste Gas&Dedusting) CO2" decimal,"Stack_2_Power House-4-Boiler-4 CO2" decimal,"Stack_6_Coke Plant Battery#07 CO2" decimal,"Stack_7_Coke Plant Battery#08 CO2" decimal,"Stack_8_Coke Plant Battery#09 CO2" decimal) order by "Date" asc
0 min < 0.1% 2,025 ms 4 sickadmin
select * from crosstab ($1, $2) as ct ("Date" timestamp , "AAQMS#01-WPFA PM10" decimal,"AAQMS#02-CRM PM10" decimal,"AAQMS#03-PH#03 PM10" decimal,"AAQMS#04-PH#06 PM10" decimal) order by "Date" asc
0 min < 0.1% 2,137 ms 3 sickadmin
select * from crosstab ($1, $2) as ct ("Date" timestamp , "AAQMS#01-WPFA CO" decimal,"AAQMS#02-CRM CO" decimal,"AAQMS#03-PH#03 CO" decimal,"AAQMS#04-PH#06 CO" decimal,"Stack_11_Coke Plant Battery 11 Process CO" decimal,"Stack_13_Sinter Plant-1 Waste Gas CO" decimal,"Stack_15_Sinter Plant # 2 Waste Gas CO" decimal,"Stack_18_Sinter Plant # 3Combined(Waste Gas&Dedusting) CO" decimal,"Stack_2_Power House-4-Boiler-4 CO" decimal,"Stack_6_Coke Plant Battery#07 CO" decimal,"Stack_7_Coke Plant Battery#08 CO" decimal,"Stack_8_Coke Plant Battery#09 CO" decimal,"Stack_9_Coke Plant Battery 10 Process CO" decimal) order by "Date" asc
0 min < 0.1% 1 ms 7,090 sickadmin
SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
FROM pg_type as t
LEFT JOIN pg_range as r ON oid = rngtypid
WHERE
  t.typelem IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48)
0 min < 0.1% 625 ms 7 sickadmin
select time_bucket_gapfill($1, "DeviceDtm") as "DeviceDtm", "ParameterName", max("Quality") as "Quality" FROM "RegisterData" rd  
   INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId" 
    INNER JOIN "Station" s ON dc."StationId" = s."StationId"  
    INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  
   INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  WHERE "DeviceDtm" >= ($2::timestamp) 
    AND "DeviceDtm" <= ($3::timestamp)  AND dc."StationId" = $4 AND "ParameterName" 
    IN ($5,$6,$7,$8,$9) Group By 1, 2 Order By 1, 2
0 min < 0.1% 1 ms 4,305 sickadmin
SELECT nsp.nspname AS schema, rel.relname AS table, con.conname AS name, fnsp.nspname AS referenced_schema, frel.relname AS referenced_table FROM pg_catalog.pg_constraint con INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid LEFT JOIN pg_catalog.pg_class frel ON frel.oid = con.confrelid LEFT JOIN pg_catalog.pg_namespace nsp ON nsp.oid = con.connamespace LEFT JOIN pg_catalog.pg_namespace fnsp ON fnsp.oid = frel.relnamespace WHERE con.convalidated = $1 /*pghero*/
0 min < 0.1% 3 ms 1,132 sickadmin
SELECT s."StationId", s."InternalLocation", s."Latitude", s."LocationId", s."Longitude", s."MonitoringType", s."NetworkId", s."StationCode", s."StationDisplayName", s."StationName", l."LocationId", l."Addr1", l."Addr2", l."Addr3", l."City", l."CustomerId", l."IndustryCategoryId", l."IsGangaBasin", l."Latitude", l."LocationCode", l."LocationDisplayName", l."LocationName", l."Longitude", l."Pincode", l."StateId", m."MiscId", m."MiscKey", m."MiscTag", m."MiscValue", s0."SysStateId", s0."StateCode", s0."StateName", s0."SysCountryId"
FROM "Station" AS s
INNER JOIN "Location" AS l ON s."LocationId" = l."LocationId"
INNER JOIN "MiscEnum" AS m ON s."MonitoringType" = m."MiscValue"
INNER JOIN "SysState" AS s0 ON l."StateId" = s0."SysStateId"
WHERE (m."MiscTag" = $2) AND (s."LocationId" = $1)
ORDER BY s."MonitoringType", lpad(s."InternalLocation", $3, $4)
0 min < 0.1% 1 ms 4,305 sickadmin
SELECT n.nspname AS schema, c.relname AS sequence, has_sequence_privilege(c.oid, $1) AS readable FROM pg_class c INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind = $2 AND n.nspname NOT IN ($3, $4) /*pghero*/
0 min < 0.1% 1 ms 4,305 sickadmin
SELECT last_value FROM "_timescaledb_catalog"."hypertable_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."tablespace_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."dimension_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."dimension_slice_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."chunk_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_config"."bgw_job_id_seq" UNION ALL SELECT last_value FROM "_timescaledb_catalog"."continuous_agg_migrate_plan_step_step_id_seq" UNION ALL SELECT last_value FROM "pgq"."consumer_co_id_seq" UNION ALL SELECT last_value FROM "pgq"."queue_queue_id_seq" UNION ALL SELECT last_value FROM "pgq"."subscription_sub_id_seq" UNION ALL SELECT last_value FROM "londiste"."table_info_nr_seq" UNION ALL SELECT last_value FROM "londiste"."seq_info_nr_seq" /*pghero*/
0 min < 0.1% 458 ms 3 sickadmin
select time_bucket_gapfill($1, "DeviceDtm") as "DeviceDtm", "ParameterName", CASE WHEN Max("Quality") = $2 THEN $3 WHEN Max("Quality") = $4 THEN $5 ELSE round(avg(nullif(cast ("NormalizedValue" as numeric), $6)), $7) END as "RegisterValue"  FROM "RegisterData" rd  INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId"  INNER JOIN "Station" s ON dc."StationId" = s."StationId"  INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  WHERE "DeviceDtm" >= ($8::timestamp) -INTERVAL $9 AND "DeviceDtm" < ($10::timestamp)  AND dc."StationId" = $11 AND "ParameterName" IN ($12,$13,$14,$15,$16) Group By 1, 2 Order By 1, 2
0 min < 0.1% 1 ms 907 sickadmin
SELECT COUNT(*)::INT
FROM "RegisterMap" AS r
WHERE r."DataType" <> $1
0 min < 0.1% 0 ms 99,919 sickadmin
SELECT "CalRemoteId", "DeviceId", "CalSeqId", "ZeroGasCylId", "SpanGasCylId" FROM "CalRemote" WHERE "CalCurrStatus" = $1 AND "CalHdrId" = $2 ORDER BY "CalSubmitDtm"
0 min < 0.1% 0 ms 99,905 sickadmin
SELECT "CalRemoteId", "CalHdrId" FROM "CalRemote" WHERE "CalAbort" = $1 AND "CalHdrId" != $2 ORDER BY "CalSubmitDtm"
0 min < 0.1% 0 ms 14,178 sickadmin
SET SESSION timezone TO 'UTC'
0 min < 0.1% 0 ms 7,088 sickadmin
SELECT t.oid, t.typname
FROM pg_type as t
WHERE t.typname IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
0 min < 0.1% 0 ms 12,968 sickadmin
-- Load enum fields
SELECT pg_type.oid, enumlabel
FROM pg_enum
JOIN pg_type ON pg_type.oid=enumtypid
ORDER BY oid, enumsortorder
0 min < 0.1% 1 ms 979 sickadmin
SELECT c."CustomerId", c."Addr1", c."Addr2", c."Addr3", c."City", c."CustomerCode", c."CustomerDisplayName", c."CustomerName", c."GroupName", c."Latitude", c."Longitude", c."Pincode", c."StateId", c."TimeZone", c."Website", l."LocationId", l."Addr1", l."Addr2", l."Addr3", l."City", l."CustomerId", l."IndustryCategoryId", l."IsGangaBasin", l."Latitude", l."LocationCode", l."LocationDisplayName", l."LocationName", l."Longitude", l."Pincode", l."StateId", i."IndustryCategoryId", i."IndustryCategoryName", s."SysStateId", s."StateCode", s."StateName", s."SysCountryId"
FROM "Customer" AS c
INNER JOIN "Location" AS l ON c."CustomerId" = l."CustomerId"
INNER JOIN "IndustryCategory" AS i ON l."IndustryCategoryId" = i."IndustryCategoryId"
INNER JOIN "SysState" AS s ON l."StateId" = s."SysStateId"
0 min < 0.1% 2 ms 408 sickadmin
SELECT nspname AS schema, relname AS table, reltuples::bigint AS estimated_rows, pg_total_relation_size(pg_class.oid) AS size_bytes FROM pg_class INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace WHERE relkind = $1 AND nspname = $2 AND relname IN ($3, $4, $5, $6) ORDER BY 1, 2 /*pghero*/
0 min < 0.1% 2 ms 408 sickadmin
SELECT schemaname AS schema, tablename AS table, attname AS column, null_frac, n_distinct FROM pg_stats WHERE schemaname = $1 AND tablename IN ($2, $3, $4, $5) ORDER BY 1, 2, 3 /*pghero*/
0 min < 0.1% 215 ms 3 sickadmin
select time_bucket_gapfill($1, "DeviceDtm") as "DeviceDtm", "ParameterName", round(avg(nullif(cast ("NormalizedValue" as numeric), $2)), $3)  as "RegisterValue"  FROM "RegisterData" rd  INNER JOIN "DeviceConfig" dc ON rd."DeviceId" = dc."DeviceId"  INNER JOIN "Station" s ON dc."StationId" = s."StationId"  INNER JOIN "RegisterMap" rm ON rd."DeviceId" = rm."DeviceId" and rd."RegisterId" = rm."RegisterId"  INNER JOIN "Unit" u ON rm."UnitId" = u."UnitId"  WHERE "DeviceDtm" >= ($4::timestamp)  AND "DeviceDtm" <= ($5::timestamp)  AND dc."StationId" = $6 AND "ParameterName" IN ($7,$8,$9,$10,$11) Group By 1, 2 Order By 1, 2
0 min < 0.1% 0 ms 2,309 sickadmin
select COUNT($1) from "DeviceConfig" dcd Where dcd."DeviceState">$2
0 min < 0.1% 0 ms 907 sickadmin
SELECT COUNT(*)::INT
FROM "Station" AS s
WHERE s."LocationId" <> $1
0 min < 0.1% 0 ms 907 sickadmin
SELECT COUNT(*)::INT
FROM "DeviceConfig" AS d
WHERE d."CommunicationType" <> $1
0 min < 0.1% 0 ms 8,004 sickadmin
SELECT * From "PcbLocation" WHERE "SpcbIndIsActive" = $1 AND "SpcbId" = $2
0 min < 0.1% 0 ms 907 sickadmin
SELECT c."CustomerId", c."Addr1", c."Addr2", c."Addr3", c."City", c."CustomerCode", c."CustomerDisplayName", c."CustomerName", c."GroupName", c."Latitude", c."Longitude", c."Pincode", c."StateId", c."TimeZone", c."Website", l."LocationId", l."Addr1", l."Addr2", l."Addr3", l."City", l."CustomerId", l."IndustryCategoryId", l."IsGangaBasin", l."Latitude", l."LocationCode", l."LocationDisplayName", l."LocationName", l."Longitude", l."Pincode", l."StateId", i."IndustryCategoryId", i."IndustryCategoryName"
FROM "Customer" AS c
INNER JOIN "Location" AS l ON c."CustomerId" = l."CustomerId"
INNER JOIN "IndustryCategory" AS i ON l."IndustryCategoryId" = i."IndustryCategoryId"
WHERE c."CustomerId" = $1
LIMIT $2
0 min < 0.1% 0 ms 14,178 sickadmin
SET standard_conforming_strings = on
0 min < 0.1% 0 ms 1,175 sickadmin
SELECT jinfo->>$1 as "CSyncTime", jinfo->>$2 as "SSyncTime"  FROM "SyncState"
0 min < 0.1% 0 ms 14,178 sickadmin
SET client_min_messages TO 'warning'
0 min < 0.1% 162 ms 1 sickadmin
SELECT n.nspname AS schema, c.relname AS relation, CASE c.relkind WHEN $1 THEN $2 WHEN $3 then $4 ELSE $5 END AS type, pg_table_size(c.oid) AS size_bytes FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname NOT IN ($6, $7) AND n.nspname !~ $8 AND c.relkind IN ($9, $10, $11) ORDER BY pg_table_size(c.oid) DESC, 2 ASC /*pghero*/
0 min < 0.1% 0 ms 4,305 sickadmin
SELECT slot_name, database, active FROM pg_replication_slots /*pghero*/
0 min < 0.1% 0 ms 13,087 sickadmin
SELECT version()
0 min < 0.1% 3 ms 29 sickadmin
SELECT d."StationId", r."DeviceId", d."DisplayName" AS "DeviceDisplayName", r."RegisterId", r."ParameterName", r."UnitId", u."UnitName", r."RegisterAddr", r."FunctionCode", r."PollIntervalSecs", r."ParameterDesc", r."NormFormula", r."DataType", m."MiscKey" AS "DataTypeDesc", r."DataPercent", r."HighStdLimit", r."IsUnipolar", r."LowStdLimit", r."ELV", r."RawUnitId", u0."UnitName" AS "DeviceUnitName", r."ReadRegisterLen", r."RegisterProperties", r."ReadOrder"
FROM "RegisterMap" AS r
INNER JOIN "DeviceConfig" AS d ON r."DeviceId" = d."DeviceId"
INNER JOIN "Unit" AS u ON r."UnitId" = u."UnitId"
INNER JOIN "Unit" AS u0 ON r."RawUnitId" = u0."UnitId"
INNER JOIN "MiscEnum" AS m ON r."DataType" = m."MiscValue"
WHERE (d."StationId" = $1) AND (m."MiscTag" = $2)
ORDER BY r."DeviceId", r."ReadOrder"
0 min < 0.1% 0 ms 8,802 sickadmin
SELECT c.relname FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = ANY (current_schemas($1)) AND c.relname = $2 AND c.relkind IN ($3,$4)
0 min < 0.1% 75 ms 1 sickadmin
SELECT pg_database_size(current_database()) /*pghero*/
0 min < 0.1% 0 ms 14,178 sickadmin
SET intervalstyle = iso_8601
0 min < 0.1% 0 ms 7,088 sickadmin
SHOW TIME ZONE
0 min < 0.1% 0 ms 1,074 sickadmin
SELECT c."CustomerId"
FROM "Customer" AS c
LIMIT $1
0 min < 0.1% 0 ms 1,082 sickadmin
SELECT COUNT(*)::INT
FROM "Location" AS l
0 min < 0.1% 1 ms 22 sickadmin
SELECT r."DeviceId" AS "deviceId", s."StationId" AS "stationId", s."StationName" AS "stationName", u."UnitName" AS "unitName", r."ParameterName" AS "parameterName", r."HighStdLimit" AS "highStdLimit", r."LowStdLimit" AS "lowStdLImit"
FROM "RegisterMap" AS r
INNER JOIN "DeviceConfig" AS d ON r."DeviceId" = d."DeviceId"
INNER JOIN "Station" AS s ON d."StationId" = s."StationId"
INNER JOIN "Unit" AS u ON r."UnitId" = u."UnitId"
WHERE (r."ParameterName" = ANY ($1) OR (((r."ParameterName" IS NULL)) AND ((array_position($1, $3) IS NOT NULL)))) AND (s."StationId" = $2)
0 min < 0.1% 0 ms 36 sickadmin
SELECT DISTINCT((s."StationName"  || $1 || rm."ParameterName")::text) as "StationParameter" from "Station" s
INNER JOIN "DeviceConfig" dc ON dc."StationId" = s."StationId" 
INNER JOIN "RegisterMap" rm ON dc."DeviceId" = rm."DeviceId" 
WHERE rm."ParameterName" IN ($2)
ORDER BY  "StationParameter"
0 min < 0.1% 12 ms 1 sickadmin
SELECT schemaname AS schema, relname AS table, indexrelname AS index, pg_relation_size(i.indexrelid) AS size_bytes, idx_scan as index_scans FROM pg_stat_user_indexes ui INNER JOIN pg_index i ON ui.indexrelid = i.indexrelid WHERE NOT indisunique AND idx_scan <= $1 ORDER BY pg_relation_size(i.indexrelid) DESC, relname ASC /*pghero*/
0 min < 0.1% 0 ms 29 sickadmin
SELECT d."DeviceId", d."AssetTag", d."BaudRate", d."ByteOrder", d."ComPort", d."CommDate", d."CommunicationType", d."ConnProperties", d."DeviceKey", d."DeviceMakeId", d."DeviceState", d."DisplayName", d."Endian", d."InstallDate", d."Ip4Address", d."Ip6Address", d."IpType2Use", d."MaxReadRegisters", d."MfgDate", d."MinSleepTimeMs", d."Parity", d."RegisterOffset", d."SerialNo", d."SlaveId", d."StationId", d."TcpPort", d0."DeviceMakeId", d0."DeviceDescription", d0."DeviceMakeName", d0."DeviceMakeSeries", d0."DeviceModelName", d0."DeviceType", d0."InternalModelName", m."MiscId", m."MiscKey", m."MiscTag", m."MiscValue"
FROM "DeviceConfig" AS d
INNER JOIN "DeviceMake" AS d0 ON d."DeviceMakeId" = d0."DeviceMakeId"
INNER JOIN "MiscEnum" AS m ON d."CommunicationType" = m."MiscValue"
WHERE (d."StationId" = $1) AND (m."MiscTag" = $2)
0 min < 0.1% 4 ms 1 sickadmin
SELECT pg_stat_activity.pid, datname AS database, usename AS user, application_name AS source, client_addr AS ip, state, ssl FROM pg_stat_activity LEFT JOIN pg_stat_ssl ON pg_stat_activity.pid = pg_stat_ssl.pid ORDER BY pg_stat_activity.pid /*pghero*/
0 min < 0.1% 2 ms 1 sickadmin
SELECT schemaname AS schema, relname AS table, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze, n_dead_tup AS dead_rows, n_live_tup AS live_rows FROM pg_stat_user_tables ORDER BY 1, 2 /*pghero*/
0 min < 0.1% 2 ms 1 sickadmin
SELECT pid, state, application_name AS source, age(NOW(), COALESCE(query_start, xact_start)) AS duration, (wait_event IS NOT NULL) AS waiting, query, COALESCE(query_start, xact_start) AS started_at, EXTRACT($1 FROM NOW() - COALESCE(query_start, xact_start)) * $2 AS duration_ms, usename AS user, backend_type FROM pg_stat_activity WHERE state <> $3 AND pid <> pg_backend_pid() AND datname = current_database() ORDER BY COALESCE(query_start, xact_start) DESC /*pghero*/
0 min < 0.1% 1 ms 1 sickadmin
SELECT state FROM pg_stat_replication /*pghero*/
0 min < 0.1% 0 ms 1 sickadmin
SELECT pid, phase FROM pg_stat_progress_vacuum WHERE datname = current_database() /*pghero*/
0 min < 0.1% 0 ms 33 sickadmin
Values ($1)
0 min < 0.1% 0 ms 21 sickadmin
Values ($1) , ($2) , ($3) , ($4) , ($5)
0 min < 0.1% 0 ms 18 sickadmin
SELECT max("DeviceDtm") FROM _timescaledb_internal._materialized_hypertable_7
0 min < 0.1% 0 ms 8 sickadmin
SELECT max("DeviceDtm") FROM _timescaledb_internal._materialized_hypertable_8
0 min < 0.1% 0 ms 3 sickadmin
Values ($1) , ($2) , ($3)
0 min < 0.1% 0 ms 3 sickadmin
Values ($1) , ($2)
0 min < 0.1% 0 ms 3 sickadmin
Values ($1) , ($2) , ($3) , ($4)
0 min < 0.1% 0 ms 1 sickadmin
SHOW random_page_cost /*pghero*/