Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-25934

Postgres selects a non-performing index for table 'history_uint' every day at a specific time

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 7.0.7
    • Server (S)
    • None
    • Ubuntu 22.04.5 LTS, zabbix-server 7.0.6, nginx 1.18.0, postgresql 14.13, timescaledb 2.17.2

      Steps to reproduce:

      1. Execute sql query before problem time "EXPLAIN ANALYZE SELECT MAX(h.clock) FROM history_uint h WHERE h.itemid='10120751' AND h.clock>1737612045;"
      2. Check execution time and kind of index
      3. Execute sql query at problematic time "EXPLAIN ANALYZE SELECT MAX(h.clock) FROM history_uint h WHERE h.itemid='10120751' AND h.clock>1737612045;"
      4. Check execution time and kind of index

      Result:
      Before problem time :
      -Execution time <1ms
      -Index  "_hyper_7_511_chunk_history_uint_1" btree (itemid, clock)
      At problematic time :
      -Execution time >5000ms
      -Index  "_hyper_7_511_chunk_history_uint_new_clock_idx" btree (clock DESC)

      Can you tell me why the SQL query behaves this way? And for what purposes is this index (*_chunk_history_uint_new_clock_idx" btree (clock DESC)) used in table 'history_uint'?

            pzakrzewski Piotr Zakrzewski
            p.kashtankin Pavel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: