← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1925528] Re: Improve "NeutronDbObject.objects_exist" performance

 

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

commit 9911d414c6a03cbdcc5f46a9ed7cfc59d70a5168
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date:   Fri Apr 23 13:23:28 2021 +0000

    Improve "objects.db.api.count" method
    
    Two improvements are implemented in this method:
    - Add a query limit number parameter. This parameter is used by
      "NeutronDbObject.objects_exist" to limit the number of registers
      retrieved to 1.
    - Add a query field parameter. This is the name (string) of the
      "obj_cls.fields" list. That will reduce the columns to be
      retrieved to only one. To check the existence of a DB register,
      there is not need to retrieve the full DB model including the back
      references.
      In case of not passing any value, the first "obj_cls.primary_keys"
      value will be used instead.
    
    Closes-Bug: #1925528
    
    Change-Id: I9fd5e306e293102c366d89c01bbe8b13721d59b0


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1925528

Title:
  Improve "NeutronDbObject.objects_exist" performance

Status in neutron:
  Fix Released

Bug description:
  Current "NeutronDbObject.objects_exist" implementation generates a
  query (quite complex most of the time) to retrieve an OVO object. That
  usually implies a large set of register columns, joined queries or
  subqueries. Then, the method adds the "count" SQL syntagm to return
  only the number of registers found.

  This query can be optimized by:
  - Limiting the number of registers to be retrieved to only one. The goal of the "objects_exist" method is to know if there are objects or not. Finding one is enough
  - Limiting the complexity of the query by requesting only one column, provided as a method parameter, that could be, for example, the ID.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1925528/+subscriptions


References