Skip to content
Advertisement

Tag: query-optimization

PostgreSQL – Query Optimization

I have this below query which takes about 15-20 secs to run. with cte0 as ( SELECT label, date, CASE WHEN Lead(label || date || “number”) OVER (PARTITION BY label || date || “number” ORDER BY “label”, “date”, “number”, “time”) IS NULL THEN ‘1’::numeric ELSE ‘0’::numeric END As “unique” FROM table_data LEFT JOIN table_mapper ON table_mapper.”type” = table_data.”type” WHERE Date

Advertisement