Mysql determines field storage size

I would like to know if the mysql command exists to determine the actual storage size used in the mysql field.

Maybe something like "show used_storage myfield FROM ... WHERE ..."

Oddly enough, I did not find anything like it.

(The same for postgresql will be interesting)

Thank you so much!

+3
source share
3 answers

For PostgreSQL you can use

SELECT your_column, pg_column_size (your_column)
FROM your_table


http://www.postgresql.org/docs/current/static/functions-admin.html

+3

,

SELECT SUM(LENGTH(myField)) From MyTable

- , , 4 INTEGER, 8 DOUBLE.

, . , , . , , - .

( ) :

SHOW TABLE STATUS LIKE 'MyTable';

, , , .

+1

Source: https://habr.com/ru/post/1781482/


All Articles