![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Id hate to go filtering for the past 2 weeks and change my program each time I need to do an update on the table. While I'm still not too literate with MySQL, you should be able to |
|
You are very right, I am working only with 2 Weeks of Data that really changes, But I found a workaround, I made the connection autocommit=false; // since its an InnoDB table, the queries were autocommitting after each execution ..i assume And then at the end of all the queries.. Con.commit(); It finishes the entire thing within 2-3 mins.. But is there anything else you would suggest for speeding up? Id hate to go filtering for the past 2 weeks and change my program each time I need to do an update on the table. Thanks for the reply.. Regards, Amit -----Original Message----- From: Robert Dunlop [mailto:rdunlopconsult (AT) earthlink (DOT) net] Sent: Wednesday, July 14, 2004 1:19 AM To: Amit_Wadhwa (AT) Dell (DOT) com; java (AT) lists (DOT) mysql.com Subject: Re: Peculiar Problem Hi Amit, I'm wondering about your logic. If I understand what you described correctly, you're really only working with 2 weeks' worth of data that actually changes? Or are your transactions really reaching all the way back through the entire table? Bob ----- Original Message ----- From: <Amit_Wadhwa (AT) Dell (DOT) com To: <java (AT) lists (DOT) mysql.com Sent: Tuesday, July 13, 2004 12:26 PM Subject: Peculiar Problem Hi All, I have a weekly problem.. ![]() Its a table with about 500,000 records, which adds another 30k every week, after the inserts, I need to do some processing on a status column for the entire table all over again (For business reasons, because previous record status may change next week). The InnoDB table structure is as follows: logid int(11), - call log id tag VC(10), - tag timestamp datetime, timestamp2 datetime, flag enum('0','1') Indexes are Below: Keyname Type Cardinality Action Field PRIMARY PRIMARY 459405 http://localhost:8081/phpMyAdmin-2.5...p?lang=en-iso- 8859-1&server=1&db=d3&table=7dayftr&goto=tbl_properties _structure.php&ba ck=tbl_properties_structure.php&index=PRIMARY http://localhost:8081/phpMyAdmin-2.5...n-iso-8859-1&s erver=1&db=d3&table=7dayftr&goto=tbl_properties_st ructure.php&back=tbl_p roperties_structure.php&sql_query=ALTER+TABLE+%607 dayftr%60+DROP+PRIMARY +KEY&zero_rows=The+primary+key+has+been+dropped> logid logid INDEX 459405 http://localhost:8081/phpMyAdmin-2.5...p?lang=en-iso- 8859-1&server=1&db=d3&table=7dayftr&goto=tbl_properties _structure.php&ba ck=tbl_properties_structure.php&index=calllogid http://localhost:8081/phpMyAdmin-2.5...n-iso-8859-1&s erver=1&db=d3&table=7dayftr&goto=tbl_properties_st ructure.php&back=tbl_p roperties_structure.php&sql_query=ALTER+TABLE+%607 dayftr%60+DROP+INDEX+% 60calllogid%60&zero_rows=Index+calllogid+has+been+ dropped> tag timestamp - Every call has a record entry in this table. - timestamp is the time when the log was made. - timestamp2 is 168 hours from the timestamp (7 days). Here is what I require. - Any tag which has another call on it within 168 hours of a log has a flag 1, else it is flag 0. - Basically there should not be another call on the same tag within 168 hours (7 days). Here is what Im doing: 1. inserting raw data into this table. 2. updating timestamp2 as timestamp + 168 hours. --- all ok so far---- Here is what I am doing: For each tag i : loop: select another logid which has a timestamp between timestamp and 7daytimestamp of (i) and has the same tag has (i) { if(exists) { update flag=1 } } loop end: next tag... ....500,000 tags.. +30k more every week it takes me about 6-8 hours to do this. I have tried Enabling/Disabling indexes before the updates, doesnt speed the process up any. Please help!!! Regards, Amit -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/java?unsub=am...hway (DOT) com -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/java?unsub=rd...link (DOT) net |
![]() |
| Thread Tools | |
| Display Modes | |
| |