Re: Finding the size of your biggest relations

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Finding the size of your biggest relations
Дата
Msg-id 13514.1474641052@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Finding the size of your biggest relations  (Artem Tomyuk <admin@leboutique.com>)
Список pgsql-admin
Artem Tomyuk <admin@leboutique.com> writes:
> Sorry,
> this query

> SELECT nspname || '.' || relname AS "relation",
>     pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
>   FROM pg_class C
>   LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
>   WHERE nspname NOT IN ('pg_catalog', 'information_schema')
>     AND C.relkind <> 'i'
>     AND nspname !~ '^pg_toast'
>   ORDER BY pg_total_relation_size(C.oid) DESC
>   LIMIT 20;

I think what's happening is that your ORDER BY is sorting nulls first.
So what's coming out at the top is temp relations that were dropped
between the time of the statement snapshot and the time that
pg_total_relation_size looked at them.  Try ORDER BY ... DESC NULLS LAST.

            regards, tom lane


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: does cluster created through initdb update postgres-reg.ini with its entry?
Следующее
От: Richard Albright
Дата:
Сообщение: PL/Python using anaconda