Вопрос

Suppose you have a UNIX process written in Oracle Pro*C that queries a large number of rows that takes very long. If you kill the process manually or with a timeout mechanism etc, will that stop the query running in Oracle database or will it keep running the keep the database instance busy?

Configuration: Oracle Database 10/11g, RedHat Enterprise Linux 4/5/6

Cheers,

Tyn

Extra Info: I'm writing 3 tier architecture software that runs on Customer System. If the end user deselects all filters and fetch the log data, the result is gigantic and will take ages for all the useless extra logs. I added in the UI to prevent unfiltered query but I'd like to fix it properly.

So I added timeouts to the client and the server side process infrastructure. I just wanted to be sure when the server side process died off, the oracle is not left busy with the big query.

Это было полезно?

Решение

It depends.

When the client process sends a request to the database, the database will continue processing that request until it has a response. If the client process dies after sending the request, the database has no way of knowing this until it is ready to send the response. At that point, it can determine that the client process has failed and abandon the request. If the performance issue that you are worried about is that it takes the database a long time to run the query in order to return the first row of the result, killing the client process will have no effect on that.

On the other hand, if the performance issue that you are worried about is that it takes a long time for the database to run the query to fetch all the rows and that it takes a long time for the client application to fetch all the data from the database, killing the client will stop the query from running. Remember that behind the scenes, the process is always

  • Client sends a request
  • Database begins processing the request
  • Once the database has the first batch of results, it sends them to the client
  • Client processes the first batch of results and requests the next batch
  • Database processes the next batch of results, sends the next batch to the client
  • Rinse and repeat until there are no more results to return.

If most of the time is being spent in the iterative portion rather than waiting for the database to produce the first batch of results, killing the client process will stop the database from spending more time generating more batches. Depending on the database settings (in particular, whether dead connection detection (DCD) is enabled), you may still want to kill the database session because it may sit there waiting for the client process to request the next batch of results but it won't be actively consuming resources while waiting.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top