Posts

Showing posts from April, 2024

MySQL SQL Notes - Part 5 (Optimization - Engines, Database Replication, Character Set, Collation )

Image
  Alternative Storage Engines In MySQL, a storage engine is a software component responsible for managing the storage of data in database tables. MySQL provides support for various storage engines, each with its own features and performance characteristics. Each storage engine implements its own set of rules and algorithms for storing, retrieving, and manipulating data. Sometimes out queries may run slower on some engines but faster on a different engine, so we can optimize SQL queries by testing performance on multiple engines and choose the one best for the operation Below are some commonly used storage engines in MySQL as followed : InnoDB: InnoDB is the default storage engine in MySQL from version 5.5 onwards. It provides support for transactions (ACID-compliant), foreign keys, and row-level locking. InnoDB is well-suited for OLTP (Online Transaction Processing) workloads where there are frequent read and write operations. Suitable for most general-purpose applications requ...

MongoDB Notes - part 3 (Mongoose ODM, Populate)

Image
  MongoDB Relationships In MongoDB, a relationship represents how different types of documents are logically related to each other. Relationships like one-to-one, one-to-many, etc., can be represented by using two different models: Embedded document model   -  In this model, the documents are embedded inside one docu ment . For example, If we have two documents "student" and "address" ,instead of creating two different documents, we embed the address documents inside the student document. This way we can retrieve the data using a single query. Reference model   -  In t his model, we maintain the documents separately but one document contains the reference of the other documents .  For example, If we have two documents "student" and "address" ,so, here student document contains the reference to  the address document’s  id  field. Now using this  reference  id we can query the address   and get the address of the student....