WHERE IN query to very large table is slow
Sometimes large in clauses can be improved by rewriting them as a join against a values clause.

so instead of

select *
from all_items
where user_id in (1,2,3,4,5)
 ...


you can use 

select ai.*
from all_items ai
   join ( 
       values (1),(2),(3),(4),(5)
   ) t(id) on t.id = ai.user_id
where item_add_date &gt;= ...
  and item_add_date &lt;= ...;


An index on (user_id, item_add_date) should improve the performance