Supabase Views or lookup in Weweb

Hi,

I’m wondering if anyone knows if it’s better to use the Supabase views or regular table with “merging” in frontend? I mean for speed and performance.

I’ve started with sb views, but in other parts opted for lookUp in weweb. Partly because I wanted realtime, and partly because it was easier.

What is best practice? Is lookup bad for performance?

Lookup is not the best, especially with big amounts of data / backend pagination, as you might miss some data pairs in my opinion. I’d suggest using JOINs via the Advanced setting within the fields. Also views don’t use Indexes, so that might affect performance :slight_smile:

We have joins? That is so much better. I just checked out some other posts about this, and wow, I wish I knew that before… Thank you! Just gotta refactor those now.

1 Like

I might have solved too early. I don’t actually reference everything. Since I have some setup the other way around.

What do you think is the best approach here:

tasks (just task data)
user_task_mapping (referencing user_id + task_id)

I want to return tasks, but select user_id from user_task_mapping where task_id = this. (can be array)

I’d probably do something like select the task table
and in the advanced I’d do:
task:id(user_id)
and then filter it by the task_id

This way you 1. JOIN the task with the user_task_mapping and then select the user_id from it and at the end filter by task_id. This logic might throw an ugly error if you have the task_id referenced in more tables, but it can be solved by reading the error and selecting the right thing, it usually tells you how to deal with disambiguation. Also, in case of any other issues, I’d suggest you post your schema, or at least the part you’re targeting to get better answers - now it’s kind of guessing.

btw: If you find yourself kind of lost with this, it’s actually completely fine, I was confused as well when I was starting, you might find useful a 1:1 with me (link in my bio).

1 Like