netbox-community / pynetbox

Python API client library for Netbox.
Apache License 2.0
567 stars 168 forks source link

Get faster response for count() method #554

Closed srfwx closed 1 year ago

srfwx commented 1 year ago

By using brief=1 parameter in the get_count() method, we can reliably get a much faster response.

As an example, without the parameter, running 100 iterations of these count action to my cloud NetBox instance: nb.dcim.cables.count() : average duration 0.1 sec nb.ipam.ip_addresses.count() : average duration 0.47 sec

By adding brief=1 : nb.dcim.cables.count() : average duration 0.075 sec nb.ipam.ip_addresses.count() : average duration 0.343 sec