Browse Source

Merge "More efficient db resources-per-stack count"

changes/91/408791/1
Jenkins 6 years ago committed by Gerrit Code Review
parent
commit
592d7c5aa6
  1. 7
      heat/db/sqlalchemy/api.py

7
heat/db/sqlalchemy/api.py

@ -741,10 +741,9 @@ def stack_get_root_id(context, stack_id):
def stack_count_total_resources(context, stack_id):
# count all resources which belong to the root stack
results = context.session.query(
models.Resource
).filter(models.Resource.root_stack_id == stack_id).count()
return results
return context.session.query(
func.count(models.Resource.id)
).filter_by(root_stack_id=stack_id).scalar()
def user_creds_create(context):

Loading…
Cancel
Save