Now you are using SQL database with nodejs and created 2 tables to store post data. Sometimes, SQL DB is more effective than no-SQL DBs like mongoDB but in your case, the best optimized method is using MongoDB. By its property, mongoDB is the fittest one for your current project. If you need to use only SQL DB, you can consider about ORM in SQL DB. Wish your good.