Re: determining how many bytes a mysql row or table is consuming
| From: | Jason G. | Date: | Thu, 08 Nov 2001 09:43:46 +0000 |
| Subject: | Re: determining how many bytes a mysql row or table is consuming | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73849@lists.php.net to get a copy of this message | ||
Check out the SHOW TABLE STATUS command. It will give you the average row length of a table.
Or, you could do this:
SELECT SUM(LENGTH(field1) + LENGTH(field2) + LENGTH(field_n)) FROM table WHERE folder='trash'
Have a Great Day!
-Jason Garber
At 04:47 PM 11/8/2001 +1030, David Robley wrote:
On Thu, 8 Nov 2001 16:39, Justin French wrote:
Hi, I'm interested in determining the bytes consumed by rows or entire tables... we have a (large) table of application forms which users can SAVE to submit to us at a later date... the problem is cleaning out those which consume space and never come back to complete. So, i'd be wanting to find the diskspace consumed by certain rows (eg WHERE status='saved' or WHERE folder='trash'). Any ideas? Only thing I can think of is to jion all the fields together into one string and determin it's length, but i'm sure there's gotta be an easy way. Note: This doesn't have to be incredibly accurate either... if it was 80% acurate, this would be sufficient. TIA Justin FrenchFor that degree of(in)accuracy, perhaps you could get away with doing some arithemtic on the output of mysql_field_type, which gives you amongst other things field type, name and length. Alternatively, mysql_fetch_lengths may be an option. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Meow... SPLAT... Ruff... SPLAT... (Raining cats & dogs) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net