Do not query datetime type filed when it is not needed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Opinion
|
Wishlist
|
Unassigned |
Bug Description
creating a datetime object is more expensive then any other type used in the database.
Creating the datetime object is expensive especially for mysql drivers, because creating the object from a datetime string representation is expensive.
When listing 4k instances with details without the volumes_extension, approximately 2 second spent in the mysql driver, which spent 1 second for parsing the datetime (DateTime_or_None).
The datetime format is only useful when you are intended to present the time for an end user, for the system the float or integer representations are more efficient.
* consider changing the store type to float or int
* exclude the datetime fields from the query when it will not be part of an api response
* remove the datetime fields from the database where it is is not really needed.
This is a really deep optimization, I think something like this needs to come up as a spec on database optimization not a one off bug.