REST API: retrieve id only ids of relations

Any update on this?

Just to be clear: the goal is to have only the ids of the relationship while avoiding an extra unnecessary read to the DB for performance reasons.

I believe it can’t be done in only one read because the relationship is not stored in one column, it is stored in another table.

For example products and categories would be split in 3 tables:

  • categories
  • products
  • products_categories__categories_products (where the relationship is stored)

But still when calling categories and extra call to products could be avoided by just calling products_categories__categories_products and returning the ids without populating it. And this is where we are stuck.

It may sound like not much, but is causing me and extra 1000+ unnecessary DB reads in a very requested endpoint.

Any solution to alleviate the problem would be welcome, no matter how hacky it feels :joy:

Thanks!