![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
I have had one issue with mysql. I have a couple of projects with relatively lagre databases (tens of gigabytes). Sometimes I have to do a DELETE operation, such as to clean up old (no longer needed) entries. When I do a DELETE, the table is locked. This may take a very long time, during which all SELECT queries are blocked. This locks to apache webserver instances locking in wait, overwhelming apache, etc. I would like to know if there is a solution for this. |
#2
| |||
| |||
|
|
On 2011-07-16 16:43, Ignoramus29044 wrote: I have had one issue with mysql. I have a couple of projects with relatively lagre databases (tens of gigabytes). Sometimes I have to do a DELETE operation, such as to clean up old (no longer needed) entries. When I do a DELETE, the table is locked. This may take a very long time, during which all SELECT queries are blocked. This locks to apache webserver instances locking in wait, overwhelming apache, etc. I would like to know if there is a solution for this. Have you considered range partitioning? http://dev.mysql.com/doc/refman/5.1/...ing-range.html |
#3
| |||
| |||
|
|
I have had one issue with mysql. I have a couple of projects with relatively lagre databases (tens of gigabytes). Sometimes I have to do a DELETE operation, such as to clean up old (no longer needed) entries. When I do a DELETE, the table is locked. This may take a very long time, during which all SELECT queries are blocked. This locks to apache webserver instances locking in wait, overwhelming apache, etc. I would like to know if there is a solution for this. |
#4
| |||
| |||
|
|
I have had one issue with mysql. I have a couple of projects with relatively lagre databases (tens of gigabytes). Sometimes I have to do a DELETE operation, such as to clean up old (no longer needed) entries. When I do a DELETE, the table is locked. This may take a very long time, during which all SELECT queries are blocked. This locks to apache webserver instances locking in wait, overwhelming apache, etc. I would like to know if there is a solution for this. |
#5
| |||
| |||
|
|
On 7/16/2011 7:43 AM, Ignoramus29044 wrote: I have had one issue with mysql. I have a couple of projects with relatively lagre databases (tens of gigabytes). Sometimes I have to do a DELETE operation, such as to clean up old (no longer needed) entries. When I do a DELETE, the table is locked. This may take a very long time, during which all SELECT queries are blocked. This locks to apache webserver instances locking in wait, overwhelming apache, etc. I would like to know if there is a solution for this. One of the simplest solutions is, rather than doing a big delete infrequently, do a small delete frequently. If you want to delete entries more than 30 days old, do it every day, or more frequently if necessary. If the WHERE expression is one that executes fast (like "mydate < '2011-03-01'", assuming "mydate" is indexed), this is cheap. If you run more than once a day, try like "mydate < TIMESTAMPADD(DAY,-31,NOW())", which is exactly 31 days ago. Partitioning is an option. but may be overkill. John Nagle |

![]() |
| Thread Tools | |
| Display Modes | |
| |