www.webdeveloper.com
Results 1 to 5 of 5

Thread: size of a row in mysql

  1. #1
    Join Date
    Jan 2005
    Posts
    592

    size of a row in mysql

    How can i calculate the data size of row in mysql. I know there is a function to get the table size but i need the row size even if it is not 100% accurate.

    Any idea.

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    there's no real functionality for a row size for a specific row, all you can do is take the table size and divide it by the # of rows to get average row size. nothing more accurate though.
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  3. #3
    Join Date
    Dec 2006
    Location
    Escaz˙ (Costa Rica) and Mallorca (Spain)
    Posts
    3,234
    You can execute a mysql query with show table status like 'myTABLE'.

    The result will be a list of all table that meet the "like" criteria. (If you enter the exact name of the table, it will return a single row).

    Within the returned row(s), you'll find a field named "Avg_row_length", which will give you an accurate reading.

    If what you are looking for is the actual size of a specific row, you'll have to select and query that row, cycle through the array returned by MySQL and add the sizes of each field.

  4. #4
    Join Date
    Feb 2006
    Location
    Where I live, people get shot. I need to move.
    Posts
    634
    so why cant PHP count the number of non zero or non null fields in a row? it is an array after all, so isnt their a length function for this type of result from a database query?
    If life gives you a hard knock once in a while, your lucky. All I keep getting is a savage beating... everyday!
    AJAX! - Javascript Sha1 & MD5 - ASCII tables - Zend DevZone - My Space
    Stop Badware - Create "TEXT FILE" in Javascript - . - wikipedia on PHP -

  5. #5
    Join Date
    Dec 2006
    Location
    Escaz˙ (Costa Rica) and Mallorca (Spain)
    Posts
    3,234
    If what you are looking for is the actual size of a specific row, you'll have to select and query that row, cycle through the array returned by MySQL and add the sizes of each field.
    I think that that's what I had just written - in any case, it's what I meant.

    Of course, as mentioned in my previous post, it really depends on the reading you're trying to get.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles