Do not query datetime type filed when it is not needed

Bug #1361631 reported by Attila Fazekas
6
This bug affects 1 person
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.

Tags: db
Tracy Jones (tjones-i)
tags: added: db
Revision history for this message
Sean Dague (sdague) wrote :

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.

Changed in nova:
status: New → Opinion
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.