When designing the data layer for the Nashaat analytics platform, the temptation to use a NoSQL document database like MongoDB was obvious on the surface: we had 13+ variable Excel schemas, evolving survey questions, and nested categories.
However, after architectural evaluation, I chose **PostgreSQL with dynamic Django model introspection**. Here is why.
### 1. Relational Integrity Across Terms
Educational decision intelligence requires strict cross-semester comparative joins. If a student's satisfaction rating drops across Term 1 and Term 2, we need guaranteed relational joins across dimensions.
In a document store, handling schema evolution across nested documents often results in orphaned sub-documents or complex aggregation pipelines that fail silently on schema drift.
### 2. ACID Transactions & Idempotent UPSERTs
Administrative spreadsheets were frequently updated and re-uploaded weekly. We implemented an MD5-hash deduplication strategy with database unique constraints:
- Re-importing the same sheet 10 times updates existing records without duplication.
- Every import batch runs inside an atomic database transaction.
### 3. The Verdict
By using relational modeling with indexed integer keys and dynamic field mapping, analytic queries execute in single-digit milliseconds, and reporting data remains 100% consistent across all 100+ schools.