Named query uses 3 parameters:
date_beg - DateTime
date_end - DateTime
location_id - Int8
The query was originally:
SELECT several columns FROM table INNER JOIN another_table ON columns WHERE enter_date <= :date_end AND exit_date >= :date_beg AND location_id = :location_id
and took 7+ seconds to execute in the designer, but less than 0.5 seconds in SSMS. I did change the dates and location for comparison purposes and tested by running in SSMS first to eliminated cached query plans as the source of the difference.
Changing location_id from a Value/Int8 to a Query String appears to have fixed the performance issue.
Any insight into this would be greatly appreciated?