diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-03-12 14:44:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-21 00:00:23 +0000 |
commit | 5b22f15557c48c1fbdc389aad67c1a5ad9f17011 (patch) | |
tree | 8274544669dcc633b14193fef67f9b54cdab22f0 /bitbake/lib | |
parent | a273d8f1510a8a711e5f2b28b51f058cffd4bff7 (diff) | |
download | poky-5b22f15557c48c1fbdc389aad67c1a5ad9f17011.tar.gz |
bitbake: toaster: targets page performance improvement
Yet another performance improvement, this time by forcing
two-step evaluation instead of using subqueries to select data.
This avoid using full-table lookups on un-indexed temporary
tables.
(Bitbake rev: 03e3286dcdc557a314c139b55b458d6fefcbc51c)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index fe016cce94..439c068515 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -2767,7 +2767,10 @@ if toastermain.settings.MANAGED: | |||
2767 | queryset_with_search = _get_queryset(Recipe, queryset_all, None, search_term, ordering_string, '-name') | 2767 | queryset_with_search = _get_queryset(Recipe, queryset_all, None, search_term, ordering_string, '-name') |
2768 | 2768 | ||
2769 | # get unique values for 'name', and select the maximum ID for each entry (the max id is the newest one) | 2769 | # get unique values for 'name', and select the maximum ID for each entry (the max id is the newest one) |
2770 | queryset_with_search_maxids = queryset_with_search.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id') | 2770 | |
2771 | # force evaluation of the query here; to process the MAX/GROUP BY, a temporary table is used, on which indexing is very slow | ||
2772 | # by forcing the evaluation here we also prime the caches | ||
2773 | queryset_with_search_maxids = map(lambda i: i[0], list(queryset_with_search.values('name').distinct().annotate(max_id=Max('id')).values_list('max_id'))) | ||
2771 | 2774 | ||
2772 | queryset_with_search = queryset_with_search.filter(id__in=queryset_with_search_maxids).select_related('layer_version', 'layer_version__layer', 'layer_version__up_branch', 'layer_source') | 2775 | queryset_with_search = queryset_with_search.filter(id__in=queryset_with_search_maxids).select_related('layer_version', 'layer_version__layer', 'layer_version__up_branch', 'layer_source') |
2773 | 2776 | ||