How to handle a sql database with so many nodes

hello everyone
im working on workflow for automating inventory managemnt for a store so basically they have sql db and an endpoint for products
but here’s the issue : the products are organized in way : category > sub-cat>sub-sub-cat>sub-sub-sub-cat> products
so what i did was i careated dedicated http request for :
1- getting all categories in db and select user most relevant to query
2- get all sub categories of this chosed category and formulate a url link to product
3- execute the http url of the product link and return results
but i noticed very weird behavior of the workflow sometimes it says the product doesnt exists although it exists in db and the ai agent tool returend url for it working fine but not executed for example.
i modified agent prompt but still got same issue
any insights??

It sounds like the issue might be related to timing or data consistency between your HTTP requests and the SQL database. Here’s a quick fix:

- Add a small delay between HTTP requests to ensure the database has time to process each query.

- Double-check the URL formatting logic to ensure it’s consistent and matches the database structure.

- Use error handling nodes in n8n to retry failed requests automatically.

This should help resolve the inconsistencies you’re experiencing.