Get the App
SLTechnology News&Howtos  ›  Database  › 

How does mysql query tablespace usage

Shulou Source: shulou.com Published: 2022-05-31 18:03:15 10月03日 Update

This article mainly explains "how to query the use of tablespaces in mysql". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "mysql how to query tablespace usage" bar!

SELECT a.tablespace_name

Round (a.total_size, 1) "total (M)"

Round (a.max_size, 1) "max (M)"

Round (a.total_size)-round (nvl (b.free_size, 0), 1) "used (M)"

Round (nvl (b.free_size, 0), 1) "free (M)"

Round (nvl (b.free_size, 0) / total_size * 100,1) "free rate (%)"

Round (nvl (a.max_size-

(round (a.total_size)-round (nvl (b.free_size, 0), 1))

0) / max_size * 100

1) "free rate2 (%)"

FROM (SELECT tablespace_name

SUM (bytes) / 1024 / 1024 total_size

SUM (CASE

WHEN autoextensible = 'NO' THEN

Bytes

ELSE

Maxbytes

END) / 1024 / 1024 max_size

FROM dba_data_files

GROUP BY tablespace_name) a

(SELECT tablespace_name, SUM (bytes) / 1024 / 1024 free_size

FROM dba_free_space

GROUP BY tablespace_name) b

WHERE a.tablespace_name = b.tablespace_name (+)

At this point, I believe you have a deeper understanding of "mysql how to query tablespace usage". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Query situation query table space content learning practical deeper interest practical practical easy to operate method more friends websites channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple MariaDB Huawei Xiaomi