My php/postgree app has follow problem:

When some users run the page proccess.php , it run a complex query in postgree.
In some cases , php return timeout, but postgree process continue at server.

How I can stop the query via SQL in php code?

In my code, I'll do: (simple syntex)
=========================
exec_postgree_query()

if php_time_out {
exec_postgree_end_this_query()
}

=========================

I prefer don't change a global limit_time in Postgre database.

tnks!