In cdb_rest/views.py (line 446), the bulk creation endpoint resolves each PayloadList individually inside the list comprehension:
batch = [PayloadIOV(...,
payload_list=PayloadList.objects.get(name=obj['payload_list']),
...)
for obj in data]
For a batch of N PayloadIOVs, this executes N separate SELECT queries to resolve PayloadList names. Pre-fetching all needed PayloadList objects in a single query would reduce this to 1 query regardless of batch size.
Additionally, if a payload_list name doesn't exist, the current code raises PayloadList.DoesNotExist which surfaces as an unhandled 500. Explicit validation would return a clearer 400 response.
In
cdb_rest/views.py(line 446), the bulk creation endpoint resolves eachPayloadListindividually inside the list comprehension:For a batch of N PayloadIOVs, this executes N separate
SELECTqueries to resolve PayloadList names. Pre-fetching all needed PayloadList objects in a single query would reduce this to 1 query regardless of batch size.Additionally, if a
payload_listname doesn't exist, the current code raisesPayloadList.DoesNotExistwhich surfaces as an unhandled 500. Explicit validation would return a clearer 400 response.