How to hook long query for debug information
This would need to be implemented in the application. You can use `SIGALARM` to do this:

``` python
def long_query(signal, frame):
    # handle long running query here
    pass

signal.signal(signal.SIGALRM, long_query)
signal.alarm(number_of_seconds_to_timeout)
try:
    execute_some_slow_query()
finally:
    signal.alarm(0)  # Clear alarm if we succeed before timing out.
```

You can, if using SQLite, look into the progress handler: https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.set_progress_handler

I found that the peewee framework doesn't provide any way to intercept any long query and it's necessary to monitor such situation for further performance improvement.

Is there any efficient way?
