Is it better to have more API calls or more data t...
# help
j
Is it better to have more API calls or more data to search? I'm working on a web directory where we use a lot of metadata (we use Dublin Core). For example, we have a table for authors, subject, geographical coverage, format and types, but since it's a many-to-many relation, we have to create some "link table", right? But, we will have to do more calls to the API to get everything we need to build the web page. In that situation, is it better to get info from 5 different tables or should we create a "relations" table with foreign relations for every table at once (meaning there would be 4 null out of 5 for each row). How do you deal with your many-to-many relationship?
s
many-to-many relationships are handled by the JS client on a single request. You can query foreign tables: https://supabase.com/docs/reference/javascript/select#query-foreign-tables And just specify the ends of the many-to-many relationship, you don't need to specify the link table.
j
And what would be faster, one junction table with multiples foreign keys or multiple junction tables? See images: