Hi, can someone help answer some of my questions r...
# help
m
Hi, can someone help answer some of my questions related to supabase and firebase's databases and which one would work best for me? I am really confused and do not want to switch and rewrite the major part of my codebase without being absolutely sure.
n
Hello @Muezz! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
s
What is your use case?
n
wubba_lubba_whatever (2022-04-01)
m
i am gonna try to give you some context. So lemme write it up...
I am making an app in flutter. The data that I have to store or display to and from the user is predefined and is as follows (I have simplified it a bit): date (DateTime) category (String) debitAcc (String) creditAcc (String) amount (double) I am using Cloud Firestore at the moment and I take the user's input, convert it into a model class called
TransactionModel
and then use that to write the transaction to ONE collection in my firestore database. What that means is that if eventually the user adds a million transaction, there will be a million such documents. That is the case of writing data. Now a user may have multiple accounts and to calculate each account's
currentBalance
, I add all of the credits, add all debits and then I have the
currentbalance = totalCreedits-totalDebits
. This kind of reads are done for each and every account and many other features in the app (profit/loss,monthly transactions, etc etc). Issue # 1: The querying in firestore is extremely complicated and I have to work with compound indexes AND having multiple
where
statements for each query is hard to work with. I fear that as the app scales up or the data stored increases, this would only get worse and the read times would increase. Issue # 2: What happens if there are lets say a million documents? Would that affect the read times given this context? Now there is Supabase and I have been looking into this since yesterday. It has an SQL based database which means working with queries would be much easier. But the second issue is still there. Would I still have to worry about read times in the calculation of lets say a particular
currentBalance
when there are a million transactions in a table?
s
ideal way can be, in supabase you maintain a separate table which just records total credits and total debits for a given user and every time a record is added/edited/deleted you can update the row you dont have to fetch all rows to display the current balance
update the row via supabase functions
m
Thats a good idea. This will save so much time on the front end. I'll try to implement supabase now. Hopefully it all works out.
I just created a project and am in the process of adding supabase to my project but for some reason I am getting this:
I have only run a pre-made script to create users table and another one for my own transactions table. Nothing else. Why is this showing so many API calls?
I havent even touched storage yet
b
Another thing to take in consideration is your need for offline support. If your app needs to work without internet i would stick with firebase for now
m
I dont have that functionality at the moment because it is just a web app but I do intend to add it later on and release for mobile too.
s
viewing tables, creating them, running queries - all will count as API calls, nothing to worry here.
m
Oh. I did not know that.
n
Thread was archived by @Muezz. Anyone can send a message to unarchive it.