Query with big IN clause I'm having an performance issue with a query, the query is something like:
Select * 
from requests 
where start_date &gt; {start_date} 
and end_date &lt; {end_date} 
and employee in {employee_id_list}

The problem is that this employee list is huge, and come from another service and could contain up to 10.000 employee_id.
Are there any better way of doing this than using the employee_id_list as parameter for this query?
try use &quot;with&quot; clase
with employees as (
--- your employee list in select statement 
--- for example:
select 1 emp_id
union
select 2 
)

select * 
from requests rq
join employees em on (em.emp_id = rq.employee)
where start_date &gt; {start_date} and end_date &lt; {end_date}