RE: Help with purging old logs for each customer ID

2012-10-25 Thread Daevid Vincent
, 2012 1:54 PM > To: Daevid Vincent; mysql@lists.mysql.com > Subject: RE: Help with purging old logs for each customer ID > > If the 90 days is back from MAX(created_on) for a given customer... >INDEX(customer_id, created_on) > will probably be needed. And that should repla

RE: Help with purging old logs for each customer ID

2012-10-25 Thread Rick James
.@daevid.com] > Sent: Thursday, October 25, 2012 1:33 PM > To: Rick James; mysql@lists.mysql.com > Subject: RE: Help with purging old logs for each customer ID > > Well, the customer_id is relevant in that I want the last 90 days > relative to each customer. > > customer_id

RE: Help with purging old logs for each customer ID

2012-10-25 Thread Daevid Vincent
Original Message- > From: Rick James [mailto:rja...@yahoo-inc.com] > Sent: Thursday, October 25, 2012 1:09 PM > To: Daevid Vincent; mysql@lists.mysql.com > Subject: RE: Help with purging old logs for each customer ID > > Off hand, I would iterate over the PRIMARY KEY, looking

RE: Help with purging old logs for each customer ID

2012-10-25 Thread Rick James
Off hand, I would iterate over the PRIMARY KEY, looking at a thousand rows at a time, DELETEing any that need to be purged. I would use a Perl or PHP loop, or write a stored procedure. More discussion of "huge deletes" (which this _could_ be): http://mysql.rjweb.org/doc.php/deletebig (PART