[ZBX-2367] Some SQL statements are quite slow Created: 2010 Apr 22  Updated: 2017 May 30  Resolved: 2010 May 06

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.8.2
Fix Version/s: 1.8.3

Type: Incident report Priority: Major
Reporter: Alexei Vladishev Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

1.8.2, PostgreSQL 8.3, 3M of records in table 'events'.



 Description   

The following SQL statement takes 30 seconds:

SELECT DISTINCT e.* FROM events e WHERE ((e.eventid BETWEEN 000000000000000 AND 099999999999999)) ORDER BY e.eventid ASC LIMIT 1 OFFSET 0;

Without DISTINCT it needs 0.1 second or less.

We should not use DISTINCT if data is selected from one table. Front-end code should be reviewed.



 Comments   
Comment by Artem Suharev (Inactive) [ 2010 May 05 ]

Need to restrict usage of DISTINCT rule in SQL's

Comment by Artem Suharev (Inactive) [ 2010 May 06 ]

Improved by adding distinct only if 2 or more tables are used in query

svn://svn.zabbix.com/branches/dev/zbx-2367

Comment by Artem Suharev (Inactive) [ 2010 May 27 ]

Implemented rev. 12315

Comment by richlv [ 2010 Jun 02 ]

already merged, seems to be working mostly fine

Generated at Thu Mar 28 18:43:02 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.