Skip to content

Instantly share code, notes, and snippets.

@weppos
Created May 20, 2010 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weppos/408157 to your computer and use it in GitHub Desktop.
Save weppos/408157 to your computer and use it in GitHub Desktop.
MongoDb vs PostgreSQL (single table with 777,229 records)
--------------------------------------------------------
# Number of Records in the table
=> 777229
# Size of the Table
# PostgreSQL (Data + Indexes)
+----------------+
| pg_size_pretty |
+----------------+
| 3344 MB |
+----------------+
1 rows in set (0.51 sec)
# PostgreSQL (Data)
+----------------+
| pg_size_pretty |
+----------------+
| 1367 MB |
+----------------+
1 rows in set (0.50 sec)
# MongoDb
"size" : 2840140372,
"storageSize" : 2953752320,
"totalIndexSize" : 217767936,
# First benchmark. Usually the slowest query
# since it needs to reclaim the RAM
# and cache the indexes
>> Benchmark.ms { MongoDb.count }
=> 1.15013122558594
>> Benchmark.ms { PostgreSQL.count }
=> 85898.7030982971
>> Benchmark.ms { MongoDb.count }
=> 1.28006935119629
>> Benchmark.ms { PostgreSQL.count }
=> 30743.2911396027
>> Benchmark.ms { MongoDb.count }
=> 1.2199878692627
>> Benchmark.ms { PostgreSQL.count }
=> 21244.5938587189
>> Benchmark.ms { MongoDb.count }
=> 1.30987167358398
>> Benchmark.ms { PostgreSQL.count }
=> 26831.0470581055
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment