Improve "neutron_lib.db.model_query.get_collection_count" method

Bug #1942863 reported by Rodolfo Alonso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Rodolfo Alonso

Bug Description

Same as in [1], the object count query should use a simpler SQL query instead of retrieving the full OVO objects. This goal of this bug is to provide a kwarg to pass a model field. The SQL query will retrieve only this field form the table register, avoiding most of the joined and nested queries.

[1]https://bugs.launchpad.net/neutron/+bug/1925528

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
importance: Undecided → Low
Changed in neutron:
status: New → In Progress
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to neutron (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/807687

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-lib (master)

Reviewed: https://review.opendev.org/c/openstack/neutron-lib/+/807686
Committed: https://opendev.org/openstack/neutron-lib/commit/64e4dc29a424249aeee9d0755f20fa400238283a
Submitter: "Zuul (22348)"
Branch: master

commit 64e4dc29a424249aeee9d0755f20fa400238283a
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Tue Sep 7 08:37:53 2021 +0000

    Improve "get_collection_count" method

    This improvement is based on [1]. "get_collection_count" can now
    request a model query requesting only one single field from the
    model. That simplifies the SQL query and improves the performance.
    The result provided will have the same number of elements; that
    means the result of the collection count will be the same.

    [1]https://review.opendev.org/c/openstack/neutron-lib/+/787672

    Closes-Bug: #1942863

    Change-Id: Ie0bffac20b9c40933b64f163de3cc03d45b24682

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron-lib 2.16.0

This issue was fixed in the openstack/neutron-lib 2.16.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by "Slawek Kaplonski <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/807687
Reason: This review is > 4 weeks without comment, and failed Zuul jobs the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/807687
Committed: https://opendev.org/openstack/neutron/commit/d4d90fb6d725f9c4d5974945d02b8eb96c236848
Submitter: "Zuul (22348)"
Branch: master

commit d4d90fb6d725f9c4d5974945d02b8eb96c236848
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Tue Sep 7 08:48:03 2021 +0000

    Improve "get_collection_count" calls

    Reduce the object retrieval to one single field to improve the
    collection count.

    Bumped neutron-lib to 2.16.0. This version contains [1], needed for
    this patch.

    [1]https://review.opendev.org/c/openstack/neutron-lib/+/807686

    Related-Bug: #1942863

    Change-Id: I160e8084e97b23a2bacb49ceb40efbac2d0715be

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.