I have form when a user can input data to find some products in a base. Query have got some unions and a lot of joins/subqueries to connect data correctly so retrieving products could take over a dozen seconds (longest runs). If the user changes the data for search and clicks submit button second time when one query is currently running, the second query is waiting to accomplish the first one.
Is there an option to kill the first running query (to not wait for it to accomplish) to speed up searching when the user wants to change its mind and find other products?
It's worth to add that I'm using a PDO interface to fetch data (sorry that I did not mention it earlier).