API create and update methods check existing names in each foreach iteration. This means a separate SQL query is executed for each name. We can optimize this to query existing names all at once. Partially this has been done in
ZBX-7981, but could also be done in other API places mentioned there: Template, Graph and Graph prototype, UserGroup and XML v1.8 import in various places.