Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieval of DeviceEvent performance degradation #2851

Closed
Coduz opened this issue Feb 10, 2020 · 0 comments · Fixed by #3017
Closed

Retrieval of DeviceEvent performance degradation #2851

Coduz opened this issue Feb 10, 2020 · 0 comments · Fixed by #3017
Assignees
Labels
Bug This is a bug or an unexpected behaviour. Fix it!

Comments

@Coduz
Copy link
Contributor

Coduz commented 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 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

@Coduz Coduz added the Bug This is a bug or an unexpected behaviour. Fix it! label Feb 10, 2020
@Coduz Coduz self-assigned this Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant