Thread: rowcount for all tables

rowcount for all tables

From
Stefan Meyer
Date:
i have a beginner question and i have read the FAQs.
is there a faster ways than
    select count(*) from foo;

to get the rowcount for the tables in my db ?

Stefan


Re: rowcount for all tables

From
Bruno Wolff III
Date:
On Fri, Mar 17, 2006 at 14:39:04 +0100, Stefan Meyer <st.meyer@mdsi.de> wrote:
> i have a beginner question and i have read the FAQs.
> is there a faster ways than
> 
>     select count(*) from foo;
> 
> to get the rowcount for the tables in my db ?

There are some ways to get approximate counts that won't require scanning
the whole table.

If you are going to be doing lots of these, you can use triggers to
maintain a count. There is also a more complicated approach that can be
used to reduce contention. You should be able to find more details in
the archives.