editi has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: (OT)Find the size of the mysql table?
by marto (Cardinal) on Jun 21, 2007 at 10:15 UTC
    Your question does not need code tags, since you have posted no code. Based on the fact you marked this question as OT I guess you are not looking for a Perl solution to this? Try SHOW TABLE STATUS LIKE 'table_name' and look at the Data_length and Index_length fields, adding them together should (IIRC) get you the total number of bytes used.

    Hope this helps

    Martin
Re: (OT)Find the size of the mysql table?
by andreas1234567 (Vicar) on Jun 21, 2007 at 10:32 UTC
    I'm certain the OP wants a perl answer, otherwise (s)he wouldn't have posted on PM:
    # perl -wle 'print -s q{/var/lib/mysql/test/foo.MYD}' 40
    --
    print map{chr}unpack(q{A3}x24,q{074117115116032097110111116104101114032080101114108032104097099107101114})
      You are certain? Since the post is marked OT, as in Off Topic and the 'topic' of this forum is Perl and they are asking 'How to find the size of the Table in Mysql' it is possible they want to know how to use MySQL to find the size of the table.

      Martin
        Irony is dangerous. I was being sarcastic. I apologize for any confusion that may have caused.
Re: (OT)Find the size of the mysql table?
by moritz (Cardinal) on Jun 21, 2007 at 09:46 UTC
    If you mean the number of rows, try

    SELECT COUNT(*) FROM $table

    If you mean something different, tell us!