How do I rewrite my query to use less temporary space?
Try the query using window functions which gets rid of the self join: 

select id, name
from (
 select id, name, my_object_id, time_in_ms, 
        count(*) over (partition by name, my_object_id, time_in_ms) as cnt
 from my_object_times t1
) t 
where cnt &gt; 1;


The partition by will still need to sort the rows, so it might be that it still needs a lot of temp space. If your server has a lot of memory, you can also increase work_mem for your session before running the statement. 

Another possible way is to use an exists query instead of the self join:

select id, name
from my_object_times t1
where exists (select *
              from my_object_times t2
              where t1.my_object_id = t2.my_object_id 
                and t1.name = t2.name 
                and t1.time_in_ms = t2.time_in_ms 
                and t1.id &lt;&gt; rt2.id);


An index on (my_object_id, name, time_in_ms, id) would help for this. 

Check the execution plan for both to see if one is cheaper then then other.