• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to obtain a database table size?

 
Tsehau Chao
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm not sure what to look for, so any pointers appreciated.

So far I've succeeded to connect to a MySQL database and insert data inside. What I'm trying to do next is to the verify that the new data actually made it to the DB, and then remove the old data from the DB.

I think I can do this by comparing the table size, but how does one obtain a certain table size? Which API should I be looking for? Thanks in advance!
 
Rajah Nagur
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the SQL Select to verify whether the new data has been inserted.

Getting table size using SQL is tricky and I'm not sure how reliable it is.
Also for your problem, SQL select would suffice.

To cut a blade of grass, your nails (SQL Select) are sufficient, axe (Table size) is an overkill option.
 
Manish Singh
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the database returns the number of rows updated by the last statement.
You can use that to find out your operation was successful or nut.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"select count(*) from table" gives you the number of rows. I think you mean number of rows and not actual number of bytes in the table.
 
Tsehau Chao
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the kind replies. I'll try to work them out! (Jeanne you're right, that IS what I mean!)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic