Most efficient report of number of records in all tables?
В списке pgsql-general по дате отправления:
| От | D. Dante Lorenso |
|---|---|
| Тема | Most efficient report of number of records in all tables? |
| Дата | |
| Msg-id | 45E35D17.3040205@lorenso.com обсуждение исходный текст |
| Ответы |
preventing ALTER TABLE RENAME from changing view definitions?
Re: Most efficient report of number of records in all tables? |
| Список | pgsql-general |
All,
I can find the names of all tables in the database with this query:
SELECT table_name
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema NOT IN ('pg_catalog', 'information_schema')
ORDER BY table_name ASC;
Then, in code, I can loop through all the table names and run the
following query:
SELECT COUNT(*) AS result
FROM $table;
But, this can be slow when I have a large number of tables of some
tables have several million rows.
Is there a faster way to get this data using table statistics or
something like that? Perhaps something in a single query?
-- Dante
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера