Consider there is a user request which needs an sql query to be executed at back-end and resultant data needs to be returned as response, but the user has already initiated another request that consist of a very long running sql query.
While the longer query is in progress, I need the the database to handle the shorter query (give the shorter query a bit more priority than long running query).
Most databases support concurrent statement execution, usually with Multiversion concurrency control (MVCC) or other mechanism. The client can usually open multiple connections to the database server and run different SQL statemenets in each connection.
You need to check how your database server handles concurrency, you can start by taking a look at this answer for MySQL . Then look into JDBC Basics docs to understand how to open multiple connections. There will be gotchas eg transaction isolation levels or lock handling that will be specific to your use case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.