Author Topic: SQL query queue status / queue flush  (Read 2560 times)


  • Administrator
  • Newbie
  • *****
  • Posts: 47
    • View Profile
SQL query queue status / queue flush
« on: March 11, 2013, 12:47:22 PM »
Hi all,

as far as I know yate knows to ways of sending queries to the database, "enqueue" and "dispatch".

"enqueue" puts the SQL query into a queue and runs it as soon as it has free resources to do so. This can lead to a growing queue under very heavy load and maybe some queries get fired long time after they were enqueued.

"dispatch" runs the SQL query synchronously against the database and waits for the result to return. This is for example used in preroute and route where it is needed because yate routes depending on the value it retrieves from DB.

What I'd like to see as feature are two things:

1) At no time there is a way (or at least I do not know any) to see how many SQL queries are currently enqueued. 'status pgsqldb' should also display the amount of enqueued SQL statements so that one know, if there are still queries that need to be run. The reason is as follows: We saw that a yate server that retrieves more calls than it can handle performs the "dispatched" queries, but may forget to run some of the "enqueued" queries (like CDR query, we found lot's of CDR records that were not updated even though they were quite old and the call was terminated). This would give the user at least the chance to see how the queue is used and if there are queries pending.

2) Referring to 1) even if the server load decreases to a normal level, some SQLs may have get lost OR are pending for infinitive time. Therefore it would be nice to see a command like 'database pgsqldb flush' that causes yate to cleanup the queue and force running the enqueued queries against the database. This would be to solve the case where enqueued SQL queries are pending and not performed by yate automatically. We hade the issue that the server did not run the queries and we could not see if there are queries in the queue (mentioned in 1)) nor could we force yate to empty the queue and run all queries (referring to 2)).

What do you think?

Diana Cionoiu

  • Administrator
  • Jr. Member
  • *****
  • Posts: 71
    • View Profile
Re: SQL query queue status / queue flush
« Reply #1 on: March 25, 2013, 11:36:36 AM »
I think both are very usefull features. However right now are not in the roadmap. But i see them as very necessary in some setups.