[MDEV-6094] Background Queries Created: 2014-04-14  Updated: 2015-11-17

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Olaf van der Spek Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: None


 Description   

Some write-only queries (insert, update, delete) could be run in the background (from a client point-of-view), but MariaDB (client) currently provides no API for this. Could such an API be added?
At first the client could spawn a worker thread and run the queries there (on a separate connection), but when protocol support becomes available a separate connection might no longer be necessary.
An ordering flag would probably be required as queries could either be run out-of-order, in-order with other background queries or in-order with all other queries.
The initial design could be emulated in application code, but the ideal design can not.
I'm aware of the async client features, but this is something different.



 Comments   
Comment by Elena Stepanova [ 2014-04-14 ]

Please check out non-blocking client library – is it what you are looking for?
(You mentioned that you are aware of the async client features, but I'm not sure what exactly you had in mind)

Comment by Olaf van der Spek [ 2014-04-14 ]

No, as I wrote: "I'm aware of the async client features, but this is something different."
Consider a PHP script. I'd like to fire (and forget) a query and continue with the script without waiting. I don't (and can't, in case of PHP) want to manually babysit MySQL connections.

Comment by Sergei Golubchik [ 2014-04-14 ]

This is basically INSERT DELAYED, isn't it? But also for DELETE and UPDATE. And with cleaner internal implementation (currently there are engines that do not support INSERT DELAYED — which means to me that it doesn't look like a normal connection thread, and it needs to be fixed).

Comment by Olaf van der Spek [ 2014-04-14 ]

It's INSERT DELAYED on steroids, but it shouldn't be limited to insert, delete or update, it should be even faster as you don't have to wait for the query being send and it allows for an initial but very useful client-side-only implementation.

Comment by Federico Razzoli [ 2014-09-26 ]

I have a suggestion. Instead of implementing this in the client lib, it could be implemented in the server. So stored procedures could do something like:

EXECUTE IN BACKGROUND <some_sql>;

I hope this is possible.

Comment by Sergei Golubchik [ 2014-10-10 ]

f_razzoli, yes, this should be easy. It's pretty much the same as an EVENT with ON COMPLETION NOT PRESERVE.

Comment by Federico Razzoli [ 2014-10-13 ]

Thanks. CREATE EVENT could be an alternative too, except that it doesn't work inside stored procedures

Generated at Thu Feb 08 07:09:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.