PostgreSQL in memory database performance issue
I'm trying to speed up my django unit test, so I wrote custom database backend using for test purposes another tablespace located in memory. But I found no real advantages, the time my test runnin开发者_如何学Cg in memory remains the same.
Then I created two similar tables using different tablespaces and run 10000 inserts for the each one. Time for the both queries was about 1 sec.
Am I missing something? Why database located in memory doesn't shows performance grow?
For inserts, you were most likely just limited by the writes to the transaction log (pg_xlog). This is not affected by you moving the tables to a different tablespace. That only comes into effect once you write enough data to go beyond what fits in the cache and/or when you run a checkpoint in the test - and 10,000 rows and 1 second is nowhere near enough to reach that.
精彩评论