I'm a newbie DBA, and I have experience in Microsoft SQL Server but I want to jump to FLOSS.
I'm starting a company, and we develop an app (PHP) with a Postgres backend, and we did some tests comparing with MySQL too. We observe that MySQL is twice as fast as PostgreSQL.
I did a tangible performance test:
- Same columns in table with equivalent column datatypes.
- Same number of rows.
- Same indexes in both (primary key included).
- The CPU load are idle and Postgres machine it's significantly better.
- And the same query (obviously).
What am I doing wrong?
P.S: I read many "howtos" on performance tuning for database engines.
P.S(2): We're using InnoDB (one file per table) on the MySQL database.
Hi Mat!
I did the three common select (and hardest) queries.
The question about disk, certainly it's not the same; In Postgres it's a SSD (almost three time fastest).
MySQL cache data:
+------------------------------+----------------------+
| Variable_name | Value |
+------------------------------+----------------------+
| binlog_cache_size | 32768 |
| have_query_cache | YES |
| key_cache_age_threshold | 300 |
| key_cache_block_size | 1024 |
| key_cache_division_limit | 100 |
| max_binlog_cache_size | 18446744073709547520 |
| query_cache_limit | 1048576 |
| query_cache_min_res_unit | 4096 |
| query_cache_size | 16777216 |
| query_cache_type | ON |
| query_cache_wlock_invalidate | OFF |
| table_definition_cache | 256 |
| table_open_cache | 64 |
| thread_cache_size | 8 |
+------------------------------+----------------------+
I don't know how to view this in PostgreSQL.
Thanks in advance.
explain analyze
. To make it easier to read, you can upload the plan to explain.depesz.compostgresql.conf