DEV Community

Discussion on: How to run a long lasting query without interruption?

Collapse
 
brandinchiu profile image
Brandin Chiu

So, a couple of things:

If an insert is taking that long, then you probably have something to clean up on your indices.

I'd take a look at those first.

As for queries where processing time is an issue, you can solve some of these problems by running them locally on the database server, as opposed to over a network connection.

So your application would log the job as needing to be completed and put it in a processing queue.

A service on the database server would read jobs out of the queue and process them locally.

Then, you can either have a separate job constantly check if the job is done, or wait for the original job to notify something or someone once it's completed.

Collapse
 
lagsurfer profile image
Barney

I went with this solution and worked out well.

Collapse
 
brandinchiu profile image
Brandin Chiu

Glad it worked out :)