From 34a3a11c96d450083e225745fe919c688f65bbec Mon Sep 17 00:00:00 2001 From: gord chung Date: Sat, 13 Jun 2015 01:20:12 -0400 Subject: [PATCH] use union all when building trait query union all is more performant as it doesn't need to filter out duplicates. we should not have duplicates as the primary key conditions already ensure that. Change-Id: Ic25f7086b33a98ca77a669732a65be5a95b7f0db --- ceilometer/event/storage/impl_sqlalchemy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ceilometer/event/storage/impl_sqlalchemy.py b/ceilometer/event/storage/impl_sqlalchemy.py index d4eb6f13..28b40859 100644 --- a/ceilometer/event/storage/impl_sqlalchemy.py +++ b/ceilometer/event/storage/impl_sqlalchemy.py @@ -282,7 +282,7 @@ class Connection(base.Connection): sa.cast(sa.null(), sa.String(255))) .filter(sa.exists().where( models.TraitDatetime.event_id == query.subquery().c.id)) - ).union( + ).union_all( session.query( models.TraitInt.event_id, models.TraitInt.key, sa.null(),