Обсуждение: query optimization - mysql vs postgresql
my team is in the process of migrating some data from a mysql (5.0) database to our core postgres (8.1.3) database.
We are running into some performance issues with the postgres versions of the queries.
MySQL takes about 150ms to run the query where postgres is taking 2500ms.
The servers for the two database clusters are identical (dual amd 64bit dual core opteron 4GB ram scsi raid array Suse 9.x)
The table schemas have not changed (to the best of my knowledge) and the indexes were created to mimic the mysql versions as well.
I have attached one particular query along with the explain output.
Does anyone see anything in the explain that might help in diagnosing the problem.
thx
Warren J. Little CTO Meridias Capital 1018 West Atherton Dr Salt Lake City, UT 84123 Ph 866.369.7763 |
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Warren Little
Sent: Thursday, May 18, 2006 9:06 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] query optimization - mysql vs postgresql
my team is in the process of migrating some data from a mysql (5.0) database to our core postgres (8.1.3) database.
We are running into some performance issues with the postgres versions of the queries.
MySQL takes about 150ms to run the query where postgres is taking 2500ms.
The servers for the two database clusters are identical (dual amd 64bit dual core opteron 4GB ram scsi raid array Suse 9.x)
The table schemas have not changed (to the best of my knowledge) and the indexes were created to mimic the mysql versions as well.
I have attached one particular query along with the explain output.
Does anyone see anything in the explain that might help in diagnosing the problem.
thx
Warren J. Little CTO Meridias Capital 1018 West Atherton Dr Salt Lake City, UT 84123 Ph 866.369.7763 |
**********************************************************************
This message contains confidential information intended only for the use of the addressee(s) named above and may contain information that is legally privileged. If you are not the addressee, or the person responsible for delivering it to the addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message immediately thereafter.
Thank you.
FADLD Tag
**********************************************************************
here are the attachments.
Not sure about the statistics question, I have done a vacuum analyze on every table in the database.
On Thu, 2006-05-18 at 09:12 -0700, Tomeh, Husam wrote:
It looks like you forgot to attach the query sample. Have you collected statistics on your tables/indexes to help the planner select a better plan?
--
Husam
http://firstdba.googlepages.com
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Warren Little
Sent: Thursday, May 18, 2006 9:06 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] query optimization - mysql vs postgresql
Hello,
my team is in the process of migrating some data from a mysql (5.0) database to our core postgres (8.1.3) database.
We are running into some performance issues with the postgres versions of the queries.
MySQL takes about 150ms to run the query where postgres is taking 2500ms.
The servers for the two database clusters are identical (dual amd 64bit dual core opteron 4GB ram scsi raid array Suse 9.x)
The table schemas have not changed (to the best of my knowledge) and the indexes were created to mimic the mysql versions as well.
I have attached one particular query along with the explain output.
Does anyone see anything in the explain that might help in diagnosing the problem.
thx
Warren J. Little
CTO
Meridias Capital
1018 West Atherton Dr
Salt Lake City, UT 84123
Ph 866.369.7763
**********************************************************************
This message contains confidential information intended only for the use of the addressee(s) named above and may contain information that is legally privileged. If you are not the addressee, or the person responsible for delivering it to the addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message immediately thereafter.
Thank you.
FADLD Tag
**********************************************************************
Warren J. Little CTO Meridias Capital 1018 West Atherton Dr Salt Lake City, UT 84123 Ph 866.369.7763 |
Вложения
Warren Little wrote: > Sorry, > here are the attachments. > Not sure about the statistics question, I have done a vacuum analyze on > every table in the database. The problem is that the planner is unable to appropiately order OUTER JOINs in released versions. In 8.2 it can do some reordering, so it would probably come up with a better plan. Without jumping to 8.2, however, the best you could do is reorder the query yourself manually. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support