Postgresql – Is there any way to optimize this SQL?
I have the following SQL statement: SELECT DISTINCT e.eventid, e.objectid, e.clock, e.ns, e.name, e.severity FROM events e, functions f, items i, hosts_groups hg WHERE e.source = '0' AND e.object = '0' AND NOT EXISTS (SELECT NULL FROM functions f, items…