Bug #1975 Query very slow in My-SQL, fast in MS-SQL

Submitted: 27 Nov 2003 14:00 Modified: 28 Dec 2003 1:29
Reporter: [ name withheld ] Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.16-nt OS:Windows (Win2000 SP4)
Assigned to: CPU Architecture:Any

[27 Nov 2003 14:00] [ name withheld ]
Description:
I have an application the runs with MS-SQL 2000, and I have ported it to use MySQL 4 for a univiersity.

The following SQL query was generated by Crystal Reports 9, which I use for reporting.

SELECT Account.sFinanceCode, TxTypes.sTxShortName, Transactions.dtTransactionDate, Transactions.cAmount, Transactions.iProduct1Usage, Transactions.iProduct2Usage, Transactions.iProduct3Usage, Transactions.iProduct4Usage, Transactions.iProduct5Usage, Transactions.iProduct6Usage, Transactions.iProduct7Usage, Transactions.iProduct8Usage, Users.sName1, Users.sName2, Transactions.lAccountId, Account.cBalance, Account.sDescription
FROM   (((Account Account INNER JOIN Transactions Transactions ON Account.cntAccountId=Transactions.lAccountId) INNER JOIN UserAccount UserAccount ON Account.cntAccountId=UserAccount.lAccountId) INNER JOIN TxTypes TxTypes ON Transactions.iTransactionType=TxTypes.cntTxTypes) INNER JOIN Users Users ON UserAccount.sBarCode=Users.sBarcodeNumber
WHERE  (Transactions.dtTransactionDate>={ts '2003-06-01 07:11:06'} AND Transactions.dtTransactionDate<{ts '2003-06-03 07:11:07'})
ORDER BY Account.sFinanceCode, Transactions.lAccountId, Transactions.dtTransactionDate

When I run the query against MS-SQL 2000 (P4-1.8, 256M), I get a result in approx 25 secs (7009 rows).

The data from the MS-SQL 2000 db has been transferred into MySQL and uses the same table structure. When I run the same query against MySQL (using the MySQL Control Centre 0.9.3-beta), the query takes 350+ secs to complete. MySQL 4 is running an AMD Athlon 2000+ with 512M RAM, Win2000 SP4.

How to repeat:
I can repeat the result every time. I have tried increasing the various buffer variables to take full advantage of the 512M RAM in the PC, but it seems to make very little effect (1-2 secs faster).

I have changed my.ini back to:

[WinMySQLAdmin]
Server=C:/mysql/bin/mysqld-nt.exe

[mysqld]
port=3306
set-variable = key_buffer_size=64M
set-variable = table_cache=256
set-variable = sort_buffer_size=4M
set-variable = read_buffer_size=1M
set-variable = max_allowed_packet=1M
set-variable = read_rnd_buffer_size=512

If I watch the CPU usage when the query is running, it is sitting on 100% for almost then entire 350 secs.
[28 Nov 2003 1:29] Sergei Golubchik
could you post here (or attach using the [Files] tab*) results of

SHOW CREATE TABLE Account;
SHOW CREATE TABLE TxTypes;
SHOW CREATE TABLE UserAccount;
SHOW CREATE TABLE Users;
EXPLAIN <your query here>;

*) in the [Files] tab you can mark you data as "private" so other users won't be able to see them
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.