Hello,<br><br>I've been using the mysqltuner script to check up on things, tune mem use to our resources, etc.  One thing remains consistent:  no matter what i have things set to, within a few hours of restart or full stop / start (at most), the Attachments table becomes fragmented.  Here's the most recent report, and i realize it's only a few hours since last restart:<br>
<br><span style="font-family: courier new,monospace;">-------- General Statistics --------------------------------------------------</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[--] Skipped version check for MySQLTuner script</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Currently running supported MySQL version 5.0.51a-3ubuntu5.1-log</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[OK] Operating on 64-bit architecture</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-------- Storage Engine Statistics -------------------------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[--] Data in MyISAM tables: 6M (Tables: 15)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[--] Data in InnoDB tables: 453M (Tables: 86)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[!!] Total fragmented tables: 1</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-------- Performance Metrics -------------------------------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[--] Up for: 3h 9m 37s (29K q [2.583 qps], 157 conn, TX: 56M, RX: 5M)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[--] Reads / Writes: 64% / 36%</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[--] Total buffers: 1.8G global + 2.6M per thread (100 max threads)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[OK] Maximum possible memory usage: 2.0G (25% of installed RAM)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Slow queries: 0% (275/29K)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[OK] Highest usage of available connections: 14% (14/100)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Key buffer size / total MyISAM indexes: 512.0M/489.4M</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[!!] Key buffer hit rate: 37.8% (386 cached / 240 reads)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Query cache efficiency: 59.0% (13K cached / 23K selects)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[OK] Query cache prunes per day: 0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Sorts requiring temporary tables: 0% (2 temp sorts / 695 sorts)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[!!] Temporary tables created on disk: 38% (366 on disk / 960 total)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Thread cache hit rate: 91% (14 created / 157 connections)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[OK] Table cache hit rate: 95% (120 open / 126 opened)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] Open file limit used: 3% (67/2K)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[OK] Table locks acquired immediately: 100% (17K immediate / 17K locks)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[OK] InnoDB data size / buffer pool: 453.2M/512.0M</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-------- Recommendations -----------------------------------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">General recommendations:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Run OPTIMIZE TABLE to defragment tables for better performance</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    MySQL started within last 24 hours - recommendations may be inaccurate</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Temporary table size is already large - reduce result set size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    Reduce your SELECT DISTINCT queries without LIMIT clauses</span><br><br>CPU's a quad-core Xeon, there's 8GB of phys RAM, and the disks are 10k SAS in hardware RAID-1.<br>
Even when used after the 24hr minimum (or 3 days, or 8 days), three things remain: a fragmented table which always turns out to be attachments; the Key Buffer Hit Rate; and the temp tables on disk stat.  I don't fully understand the latter two and haven't figured it out yet by online docs and commentary, but i get the impression it's the nature of our DB structure and queries used.<br>
<br>Important note about that - the MySQL server on this box is hosting two DBs.  rt3 is one, but an internal DB we use for mumble mumble is also on the box.  I'm not sure if that custom-written DB and its UI used across the office by all employees is the reason for the key buffer / temp table alerts; the programmer for that one is working on the two recommendations of reducing result sets (may not be possible) and making sure there are LIMITs on his queries wherever possible.<br>
<br>Should I be worried about the constantly-fragmenting Attachments table?  Can i get more fine-grained info about it from within MySQL?<br><br>Thanks,<br>Rob<br><br>-- <br>/chown -R us:us /yourbase<br><br><br>