[ZBX-13266] history.get API with lots of items is slow Created: 2017 Dec 28  Updated: 2019 Oct 02  Resolved: 2019 Oct 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Proxy (P), Server (S)
Affects Version/s: 3.0.13
Fix Version/s: 4.0.13rc1, 4.2.7rc1, 4.4.0beta1, 4.4 (plan)

Type: Problem report Priority: Minor
Reporter: Kodai Terashima Assignee: Michael Veksler
Resolution: Fixed Votes: 1
Labels: performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PDF File DATABASE PERFORMANCE TESTS.pdf     File lld-data.7z     File zbx-13266.patch    
Team: Team A
Sprint: Sprint 25, Sprint 26, Sprint 32, Sprint 33, Sprint 34, Sprint 35, Sprint 36, Sprint 37, Sprint 38, Sprint 39, Sprint 40, Sprint 41, Sprint 42, Sprint 43, Sprint 44, Sprint 45, Sprint 46, Nov 2018, Sprint 47, Dec 2018, Sprint 48, Jan 2019, Sprint 56 (Sep 2019), Sprint 55 (Aug 2019), Sprint 49 (Feb 2019), Sprint 50 (Mar 2019), Sprint 51 (Apr 2019), Sprint 52 (May 2019), Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
Story Points: 2

 Description   

history.get API is slow when request has lots of items, for example, a history.get request with 2000 items takes 5-8 seconds

The cause of problem is SQL query, history.get API creates select query like:

SELECT h.* FROM history_uint h WHERE (h.itemid BETWEEN '23740' AND '23771' OR h.itemid BETWEEN '23781' AND ...

This query is much faster

SELECT h.* FROM history_uint h WHERE h.itemid IN ('23740','23771','23781' ....);


 Comments   
Comment by Alexander Vladishev [ 2019 Jul 08 ]

Fixed in development branch ZBX-13266-4.0

Comment by Alexander Vladishev [ 2019 Jul 10 ]

API fixed in:

Comment by Michael Veksler [ 2019 Sep 20 ]

Available in:

  • 4.0.13rc1 8933485910
  • 4.2.7rc1 bb36e864fa
  • 4.4.0beta1(master) f67a0a6af8
Generated at Fri Mar 29 00:52:39 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.