SQLize
Online
/
PHPize Online
/
SQLtest Online
A
A
A
Share
Donate
Blog
Popular
Donate
A
A
A
Share
Blog
Popular
SQLize.online is a free online SQL environment for quickly running, experimenting with and sharing code.
You can run your SQL code on top of the most popular RDBMS including MySQL, MariaDB, SQLite, PostgreSQL, Oracle and Microsoft SQL Server.
SQL code:
Upload
Copy
Format
Clear
CREATE OR REPLACE VIEW v_used_size_per_user AS ( WITH used_per_schema_user_total_size_counter AS ( SELECT users.usename AS table_owner, pgn_cur_class.nspname AS schema_name, SUM(pg_relation_size(cur_class.oid)) AS used_per_schema_user_total_size FROM pg_class cur_class, pg_user users, pg_namespace pgn_cur_class WHERE cur_class.relowner = users.usesysid AND pgn_cur_class.oid = cur_class.relnamespace GROUP BY users.usename, pgn_cur_class.nspname ), used_user_total_size_counter AS ( SELECT users.usename AS table_owner, SUM(pg_relation_size(cur_class.oid)) AS used_user_total_size FROM pg_class cur_class, pg_user users WHERE cur_class.relowner = users.usesysid GROUP BY users.usename ) SELECT users.usename AS table_owner, pgn_cur_class.nspname AS schema_name, cur_class.relname AS table_name, pg_size_pretty(pg_relation_size(cur_class.oid)) AS table_size, pg_size_pretty(used_per_schema_user_total_size_counter.used_per_schema_user_total_size) AS used_per_schema_user_total_size, pg_size_pretty(used_user_total_size_counter.used_user_total_size) AS used_user_total_size FROM pg_class cur_class, pg_user users, pg_namespace pgn_cur_class, used_user_total_size_counter, used_per_schema_user_total_size_counter WHERE cur_class.relowner = users.usesysid AND pgn_cur_class.oid = cur_class.relnamespace AND used_user_total_size_counter.table_owner = users.usename AND used_per_schema_user_total_size_counter.table_owner = users.usename AND used_per_schema_user_total_size_counter.schema_name = pgn_cur_class.nspname ); SELECT table_owner, table_name, table_size, schema_name, used_per_schema_user_total_size, used_user_total_size FROM v_used_size_per_user ORDER BY pg_size_bytes(used_user_total_size) DESC, table_owner, pg_size_bytes(used_per_schema_user_total_size) DESC, schema_name, pg_size_bytes(table_size) DESC, table_name;
SQL
Server:
MariaDB 11.4
MariaDB 11.5
MariaDB 10
MariaDB 10 Sakila (ReadOnly)
MySQL 5.7
MySQL 5.7 Sakila (ReadOnly)
MySQL 8.0
MySQL 8.0 Sakila (ReadOnly)
SQLite 3
SQLite 3 Preloaded
PostgreSQL 10 Bookings (ReadOnly)
PostgreSQL 11
PostgreSQL 12
PostgreSQL 13
PostgreSQL 14
PostgreSQL 15
MS SQL Server 2017
MS SQL Server 2019
MS SQL Server 2022
MS SQL Server 2022 AdventureWorks (ReadOnly)
Firebird 4.0
Firebird 4.0 (Employee)
Oracle Database 19c (HR)
Oracle Database 21c
Oracle Database 23c Free
SOQOL
Version
ER Diagram
Preserve result
Stuck with a problem?
Got Error?
Ask ChatGPT!
Result:
Copy
Clear