Re: [GENERAL] Determine size of table before it's committed?
От | Melvin Davidson |
---|---|
Тема | Re: [GENERAL] Determine size of table before it's committed? |
Дата | |
Msg-id | CANu8FizYYyNW70-RADuAtR2YetPkxhVr2yyx_JRARDz+5KXj4Q@mail.gmail.com обсуждение исходный текст |
Ответ на | [GENERAL] Determine size of table before it's committed? (Seamus Abshere <seamus@abshere.net>) |
Список | pgsql-general |
On Wed, Oct 11, 2017 at 9:43 AM, Seamus Abshere <seamus@abshere.net> wrote:
hi,
I've had an `INSERT INTO x SELECT FROM [...]` query running for more
then 2 days.
Is there a way to see how big x has gotten? Even a very rough estimate
(off by a gigabyte) would be fine.
Best,
Seamus
--
Seamus Abshere, SCEA
https://www.faraday.io
https://github.com/seamusabshere
https://linkedin.com/in/seamusabshere
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
>Is there a way to see how big x has gotten?...
Try:
SELECT n.nspname as schema,
c.relname as table,
a.rolname as owner,
c.relfilenode as filename,
c.reltuples::bigint,
pg_size_pretty(pg_relation_ size(n.nspname|| '.' || c.relname)) as size,
pg_size_pretty(pg_total_ relation_size(n.nspname|| '.' || c.relname)) as total_size,
pg_relation_size(n.nspname|| '.' || c.relname) as size_bytes,
pg_total_relation_size(n. nspname|| '.' || c.relname) as total_size_bytes,
CASE WHEN c.reltablespace = 0
THEN 'pg_default'
ELSE (SELECT t.spcname
FROM pg_tablespace t WHERE (t.oid = c.reltablespace) )
END as tablespace
FROM pg_class c
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_authid a ON ( a.oid = c.relowner )
WHERE relname = 'x'
ORDER BY total_size_bytes DESC, 1, 2;
c.relname as table,
a.rolname as owner,
c.relfilenode as filename,
c.reltuples::bigint,
pg_size_pretty(pg_relation_
pg_size_pretty(pg_total_
pg_relation_size(n.nspname|| '.' || c.relname) as size_bytes,
pg_total_relation_size(n.
CASE WHEN c.reltablespace = 0
THEN 'pg_default'
ELSE (SELECT t.spcname
FROM pg_tablespace t WHERE (t.oid = c.reltablespace) )
END as tablespace
FROM pg_class c
JOIN pg_namespace n ON (n.oid = c.relnamespace)
JOIN pg_authid a ON ( a.oid = c.relowner )
WHERE relname = 'x'
ORDER BY total_size_bytes DESC, 1, 2;
--
Melvin Davidson
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

В списке pgsql-general по дате отправления: