0

I come from SQL background, so Firebase is pretty big shift for me. My most recent project requires me to consider only useing Firebase for data and file storing.

The project is a social messaging app that has already up to 100K registered users.

My concern is, can Firebase fully substitute SQL? Features that I find problematic:

  1. Filtering millions of messages for specific keywords (language moderation)
  2. Allowing users to block each other (should take effect immediately both ways)
  3. Remotely logging-out users from unwanted devices
  4. Monitoring daily statistics (how many likes, messages, users appeared which day)
  5. Filtering users by various attributes (name, distance, gender, age)

I want to avoid situation 2 years down the line, when 50 million messages have been sent and suddenly a bad-language filter needs to be put in place. Now what.

In SQL I would run

delete from messages where content like "%bad-word%"

5 minutes later, done.

So my question is, can Firebase fully substitute SQL?

John Doe
  • 983
  • 4
  • 14
  • 27

1 Answers1

1

No, firebase can't fully substitute SQL as of now. But there are solutions to the problems you mentioned while using Firebase with 3rd party systems or custom implementations.

Before considering firebase for your solution in place of SQL, you should consider that it is noSQL, and has entirely different paradigm. There are many usecases that are easy to implement with noSQL, so it depends on the scenario. Firebase is better suited for realtime scenarios.

  1. Firebase (Real Time DB or Firestore) doesn't have full text search as of now. You will have to use Algolia or ElasticSearch or do some custom implementation similar to this (and some other articles available online).

  2. If blocking users simply means adding an entry to some one on one table that tells user X blocked user Y, firebase can do it with realtime execution.

  3. We can remotely logout users using admin sdk, like this.

  4. Not supported. You will have to maintain a count key for each stat you want to get, else you will have to fetch all (or partial of all) data and count on client side.

  5. You can query records on a number of factors. As a reference please look at firebase firestore queries.

Please let me know if you have any questions.

amsh
  • 3,097
  • 2
  • 12
  • 26
  • Thank you, I was worried that Firebase is as of today not a proper substitute for SQL. Are firestore queries scalable? Will such query be as fast on collection of millions of documents? – John Doe Oct 22 '20 at 11:29
  • Firebase Firestore claims to support GB's and TB's of datasets for read operations, unlike Firebase realtime DB. You may refer to this link: https://firebase.google.com/docs/database/rtdb-vs-firestore – amsh Oct 22 '20 at 11:34