maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #05761
Re: RFC: Pausing a query thread
Hi, Marian!
On Jun 24, Marian Marinov wrote:
> Hi guys,
>
> I work with hosting companies and all of my clients have the same
> irritating problem, one query taking a lot of time to finish and
> consuming a lot of resources.
>
> So I have solved the same issue but with processes on the machine by
> simply pausing(kill -STOP) these processes when the load is high and
> continuing(kill -CONT) them when the server load goes down.
>
> I want to implement the same logic within MariaDB, so I can STOP/CONT
> the thread that is executing this query.
>
> My idea is to implement this in the 'KILL query_id' function, so it
> will accept one more argument, which will be either STOP or CONT. If
> the parameter is not present, the default behavior should remain.
>
> What do you think about my approach?
That's surely possible. And it can be done with a relatively small patch.
But note that if you "pause" a query that's holding locks, be it
pthread mutexes, row locks, table locks, metadata locks, whatever, all
other connections that might need them will "pause" too. They'll wait
for the lock, and may eventually time out.
Regards,
Sergei
Follow ups
References