Merge "More efficient db resources-per-stack count"
This commit is contained in:
commit
592d7c5aa6
|
@ -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…
Reference in New Issue