optimization of expensive subquery
This can be considerably simpler and faster with DISTINCT ON:

SELECT DISTINCT ON (r.unit_id)
       r.* 
FROM   reports r
JOIN   units   u ON u.id = r.unit_id 
WHERE  r.unit_id IN (1111, 1112, 1113) 
AND    r.time_secs &lt;&gt; 0
AND    r.latitude  &lt;&gt; 0.0
AND    r.longitude &lt;&gt; 0.0
ORDER  BY r.unit_id, r.time DESC;


More explanation in these related answers:
How do I efficiently get &quot;the most recent corresponding row&quot;?
Select first row in each GROUP BY group? (on SO)

Minor detail: the standard SQL operator for "is not equal" is &lt;&gt;. Use that rather than != (which is accepted as well in Postgres).

The only possible purpose of joining to the table units in this query is to verify that one or more related rows exist. If reports.unit_id is bound to unit.id by foreign key (as the naming suggests) referential integrity is guaranteed and you can drop the table unit from the query completely. Just add: unit_id IS NOT NULL.

SELECT DISTINCT ON (unit_id) * 
FROM   reports
WHERE  unit_id IN (1111, 1112, 1113) 
AND    time_secs &lt;&gt; 0
AND    latitude  &lt;&gt; 0.0
AND    longitude &lt;&gt; 0.0
AND    unit_id IS NOT NULL
ORDER  BY unit_id, time DESC;