You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When having an high number of DeviceEvents for a Device, the retrieval performance degrades over time with increasing of the DeviceEvents present.
Looking at a deployment that contained ~70000 DeviceEvents for a Device, the retrieval takes more than 30s. Executing some SQL queries it appears that SORTing by received_on DESC takes the most time. Running the same query without SORTing is much faster.
Looking at the table definition the received on is not one of the indexed fields so that's the reason why it takes so long, since for each query to the DeviceEvents table it requires the sorting of the whole result set after the filtering of the WHERE clause.
To Reproduce
Create a device and add a lot of Device Events to that device (e.g. 70000), it does not matter the content.
Query the table with ordering by received_on, which is the default sorting of DeviceEvents, and look at the time that it takes. Run the same query without sorting and the query takes a lot less time.
This behaviour can be seen also by simply running SELECT COUNT(*) FROM DVC_DEVICE_EVENTS with and without the SORT BY.
Expected behavior
The queries must be much more performant! We should include the received_on field in the indexes.
Screenshots None
Version of Kapua
<= 1.1.2
Type of deployment
All
Main component affected
Console
REST API
Additional context None
The text was updated successfully, but these errors were encountered:
Coduz
added
the
Bug
This is a bug or an unexpected behaviour. Fix it!
label
Feb 10, 2020
Describe the bug
When having an high number of DeviceEvents for a Device, the retrieval performance degrades over time with increasing of the DeviceEvents present.
Looking at a deployment that contained ~70000 DeviceEvents for a Device, the retrieval takes more than 30s. Executing some SQL queries it appears that SORTing by
received_on
DESC takes the most time. Running the same query without SORTing is much faster.Looking at the table definition the received on is not one of the indexed fields so that's the reason why it takes so long, since for each query to the DeviceEvents table it requires the sorting of the whole result set after the filtering of the WHERE clause.
To Reproduce
Create a device and add a lot of Device Events to that device (e.g. 70000), it does not matter the content.
Query the table with ordering by
received_on
, which is the default sorting of DeviceEvents, and look at the time that it takes. Run the same query without sorting and the query takes a lot less time.This behaviour can be seen also by simply running
SELECT COUNT(*) FROM DVC_DEVICE_EVENTS
with and without theSORT BY
.Expected behavior
The queries must be much more performant! We should include the
received_on
field in the indexes.Screenshots
None
Version of Kapua
<= 1.1.2
Type of deployment
All
Main component affected
Console
REST API
Additional context
None
The text was updated successfully, but these errors were encountered: