Postgresql – Performance loss introducing lateral join in Postgres query
I am dealing with a PostgreSQL (v14) query of this kind SELECT ..., EXISTS ( SELECT 1 FROM table2 t2 WHERE t2.fk = t1.id AND LOWER(t2.table_name) = 't1' ) AS t2_record_exists FROM table1 t1; and was hoping to extract the…