MongoDB vs MySQL: A Real-World Performance Showdown Using Disneyland Data

MongoDB vs MySQL: A Real-World Performance Showdown Using Disneyland Data

Published

MongoDB vs MySQL head-to-head: We benchmarked both databases with real Disneyland data. MongoDB won writes by 67% and some queries by 98%, but MySQL had surprises too!

When choosing a database for your next project, performance benchmarks often feel abstract and disconnected from real-world scenarios. That's why our recent university project comparing MongoDB and MySQL using actual Disneyland visitor data provides such valuable insights – we tested both databases against the same complex dataset with realistic use cases.

The Dataset: Perfect for Database Testing

We used a comprehensive Disneyland Paris dataset that presented real analytical challenges:

  • Wait times for 37 attractions (2018-2019)
  • Daily attendance data (2018-2022)
  • Weather conditions (1999-2022)
  • Park operational schedules (2018-2022)

This dataset was ideal for performance testing because it required:

  • High-frequency writes (weather data every hour, wait times every 15 minutes)
  • Complex aggregations across multiple data sources
  • Time-series analysis
  • JOIN operations between related data

Database Setup: Fair Fight Conditions

To ensure a fair comparison, we:

  • Identical hardware: Same server (20GB RAM, 6 CPU cores, HDD storage)
  • Equivalent indexing: Created the same indexes on both systems
  • Standardized schema: Normalized data structure for MySQL, embedded documents for MongoDB
  • Same queries: Translated identical business logic between SQL and MongoDB aggregation pipelines

Schema Differences

MySQL: Traditional normalized approach with separate tables for weather descriptions, linked via foreign keys.

MongoDB: Document-based approach with embedded weather objects, eliminating the need for joins.

Performance Results: The Numbers Don't Lie

We ran each query 100 times sequentially to get reliable averages. Here are the results:

Write Operations (Data Insertion)

OperationMySQLMongoDBMongoDB Advantage
Weather Data Insert56.7ms19.6ms65.4% faster
Wait Times Insert59.2ms19.3ms67.4% faster
Attendance Insert57.2ms19.3ms66.2% faster
Schedule Insert57.7ms28.4ms50.7% faster

Takeaway: MongoDB consistently outperformed MySQL for write operations, often by more than 2:1 ratios.

Read Operations (Analytics Queries)

Query TypeMySQLMongoDBWinner
RQ1: Average wait times by attraction52.6 seconds1.0 secondsMongoDB (98.1% faster)
RQ2: Attendance by weather conditions413ms20.7 secondsMySQL (98% faster)
RQ3: Wait times vs weather correlation1h 12m 37s5ms*MongoDB
RQ4: Holiday vs regular attendance66.3ms58.5msMongoDB (11.7% faster)

*MongoDB query completed quickly, MySQL query failed after 4+ hours

What These Results Actually Mean

MongoDB's Strengths Revealed

  1. Simple Aggregations: The 98% performance advantage in RQ1 shows MongoDB's aggregation pipeline excels at straightforward grouping and averaging operations.

  2. Complex Time-Based Queries: RQ3's dramatic difference (MySQL took over an hour, MongoDB completed in milliseconds) demonstrates MongoDB's superiority for complex temporal correlations.

  3. Write-Heavy Workloads: Consistent 50-67% faster write performance makes MongoDB ideal for real-time data ingestion scenarios.

MySQL's Surprising Victory

RQ2 (weather-based attendance analysis) was 98% faster in MySQL. This query required complex temporary table operations and multiple data source correlations – an area where SQL's mature optimization still shines.

The Technical Why Behind the Performance

MongoDB Advantages:

  • No JOIN overhead: Embedded documents eliminate expensive table joins
  • Optimized aggregation pipeline: Purpose-built for analytical workloads
  • Flexible indexing: Better suited for document-based queries
  • Schema flexibility: No rigid structure constraints during writes

MySQL Advantages:

  • Mature query optimization: Decades of SQL optimizer improvements
  • Efficient temporary operations: Better handling of complex intermediate results
  • Memory management: Superior for certain multi-table operations

Real-World Application Insights

Based on our findings, choose:

MongoDB when you have:

  • High-frequency data ingestion (IoT sensors, real-time analytics)
  • Time-series data analysis
  • Simple to moderate aggregation needs
  • Schema evolution requirements

MySQL when you have:

  • Complex multi-source data correlations
  • Heavy use of temporary tables and complex JOINs
  • Mature application ecosystems expecting SQL
  • Strict consistency requirements

The Unexpected Learning: Context Matters

The most valuable insight wasn't that one database is universally better – it's that workload characteristics determine the winner. MongoDB dominated write operations and simple aggregations by massive margins, while MySQL excelled at complex relational operations.

Performance Optimization Lessons

  1. Index Strategy: Both databases benefited equally from proper indexing on date fields and frequently queried attributes.

  2. Query Design: MongoDB's aggregation pipelines required different thinking than SQL, but often resulted in more maintainable code.

  3. Hardware Considerations: Even on modest hardware (HDD storage), the performance differences were dramatic, suggesting they'd be even more pronounced on modern SSD systems.

Bottom Line for Database Selection

Don't choose a database based on hype or familiarity alone. Our Disneyland data analysis proved that:

  • Write-heavy applications: MongoDB provides substantial advantages
  • Complex analytical queries: Results vary dramatically by query type
  • Mixed workloads: Consider using both databases for different use cases

The 98% performance differences we observed aren't edge cases – they represent real-world scenarios that could mean the difference between a responsive application and one that frustrates users.


This performance analysis was conducted as part of a Modern Database Systems course at TH Köln. The complete benchmark code and query implementations are available here for those interested in replicating these tests.

Tags:Link.Link

Subscribe to my Newsletter

Get the latest posts delivered right to your inbox

Avatar of Christian Holländer

Christian Holländer

Creative Software-developer working at werdetnachbarn.de