Home » Performance » MySQL » Performance query count and subselect
Performance query count and subselect [message #1270] Fri, 18 May 2007 12:27 Go to previous message
buxmac  is currently offline buxmac
Messages: 4
Registered: May 2007
Junior Member
Hi,

I have this query:

SELECT COUNT(*) FROM `transaction_table`
WHERE RESPONSE='0' AND DATEDIFF(CURDATE(), TRANSACTION_DATE) <= 3
AND PAN_ENCRYPTED=
(
SELECT PAN_ENCRYPTED FROM `transaction_table`
WHERE TRANSACTION_ID='580' AND RESPONSE='0'
)

My db is a InnoDb and i use mysql 5.

How to improve the speed of my query?
It's better to use ROW_COUNT and not COUNT(*) ?
It's better make two distinct queries or a subselect?

Thank you

Andrea

Read Message
Read Message
Read Message
Read Message
Previous Topic:mysql join optimization question
Next Topic:Very slow connection time over network.
Goto Forum:

  


Current Time: Fri Jul 10 02:59:12 EDT 2009

Total time taken to generate the page: 0.08809 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.