| | |
Help optimizing a query
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2008
Posts: 6
Reputation:
Solved Threads: 0
Hi there,
Can someone please help me in optimizing a query.
The query that I have is as follows:
MEMBER_SEQUENCE: DECIMAL (INDEX)
PURCHASE_VALUE: DECIMAL
QUANTITY: DECIMAL
PRODUCT_NO: DECIMAL (INDEX ON BOTH TABLES)
TRANSACTION_DATE: DATETIME
If anyone knows what steps I should take to speed this up that would be great.
Thanks, Bernie
Can someone please help me in optimizing a query.
The query that I have is as follows:
MySQL Syntax (Toggle Plain Text)
CREATE TABLE RED_WINE_TXN AS SELECT MEMBER_SEQUENCE, SUM(PURCHASE_VALUE) PURCHASE_VALUE, SUM(QUANTITY) QTY FROM PURCHASE_DETAILS a, RED_WINE_SKUS b WHERE a.PRODUCT_NO=b.PRODUCT_NO AND TRANSACTION_DATE>=20071101 GROUP BY MEMBER_SEQUENCE
MEMBER_SEQUENCE: DECIMAL (INDEX)
PURCHASE_VALUE: DECIMAL
QUANTITY: DECIMAL
PRODUCT_NO: DECIMAL (INDEX ON BOTH TABLES)
TRANSACTION_DATE: DATETIME
If anyone knows what steps I should take to speed this up that would be great.
Thanks, Bernie
Use EXPLAIN followed by your query to get an explanation about the query from MySQL. Then you can analyze this output to know how your query is performing, then based on this you can optimize your query accordingly.
Suggestion : Use the Internet to your advantage, you could have as easily found this out from the net if you would have taken the pains to search the net.
Suggestion : Use the Internet to your advantage, you could have as easily found this out from the net if you would have taken the pains to search the net.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
![]() |
Similar Threads
- Optimizing a lot of foreach loops. Please help. (PHP)
- Best way to query (MySQL)
- How can I speed up multi select query? (MySQL)
- database query limitations (MySQL)
- need help optimizing (MS SQL)
- SEOing your forum and optimizing your database (Growing an Online Community)
Other Threads in the MySQL Forum
- Previous Thread: Help table partition design mysql
- Next Thread: tracing value changes in my tables
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm database design developer development distinct drupal dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





