How long is a sql query too long in Asterisk?

Hi,

We are using Asterisk 16.1 realtime with MariaDB and I have noticed that once in a while I get query over 1 second when the ps_contacts table is updated:

# User@Host: asterisk[asterisk] @ localhost []
# Thread_id: 1069  Schema: asterisk  QC_hit: No
# Query_time: 1.060882  Lock_time: 0.000024  Rows_sent: 0  Rows_examined: 1
SET timestamp=1545282510;
UPDATE ps_contacts SET via_addr='10.188.4.3', qualify_timeout='3.000000', call_id='2633635102', reg_server='Garneau-PBX', prune_on_boot='no', path='', endpoint='PAGE_SERVER_1', via_port='5061', authenticate_qualify='no', uri='sip:PAGE_SERVER_1@10.188.4.3:5061^3Bline=9b199325cd76f44', qualify_frequency='0', user_agent='SIP Paging Adapter SW/v11.6.1', expiration_time='1545282569', outbound_proxy='' WHERE id='PAGE_SERVER_1^3B@b911884787d383e505cfad2a2c6fb0f9';

Should I investigate a bit more or it is something that can happen and I do not have to worry about it.?

It depends. You really want SQL queries to complete as fast as possible. The longer they take the more things can pile up, slow things down, and cascade into failure. An occasional 1 second query should be fine though.