Skip to content

Icinga DB: Add new mysql column downtime.duration and service_state.host_id #9049

Closed
@yhabteab

Description

@yhabteab

Is your feature request related to a problem? Please describe.

As it turned out during the analysis of Icinga DB Web's query, these columns would be of great benefit as the queries can be significantly optimized. In order to determine the duration of the downtime, Icinga DB Web performs such queries that cannot be easily optimized by indexes without introducing a separate column for it. Hence, it would actually be very helpful when this is already handled beforehand by Icinga2, as then Icinga DB Web would have less to compute and the query would be optimized by using indexes.

[...]
(CASE WHEN downtime.is_flexible = 'y' THEN downtime.flexible_duration
      ELSE downtime.scheduled_end_time - downtime.scheduled_start_time END) AS duration, ...
[...]
ORDER BY CASE WHEN is_flexible = 'y' THEN flexible_duration ELSE scheduled_end_time - scheduled_start_time END desc
[...]

And the benefit of host_id in service_state is that in combination with some columns like severity, which are needed for ordering the result sets, and when joining the tables, the query would be executed much faster.

using host_id without view
330ms 502ms Host services
350ms 1s 200ms Services view

Additional context

Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions