Page 1 of 1

ANALYZE_EXTERNAL_ROW_COUNT - Where's the counts?

Posted: Thu Oct 29, 2015 3:22 pm
by beth
Good morning,

The ANALYZE_EXTERNAL_ROW_COUNT calculates the exact number of rows in an external table.

Where does it store these row counts?
'

Re: ANALYZE_EXTERNAL_ROW_COUNT - Where's the counts?

Posted: Thu Oct 29, 2015 6:40 pm
by NorbertKrupa
In a dark place (probably catalog; not 100% sure). You should be able to export them using export_statistics.

Re: ANALYZE_EXTERNAL_ROW_COUNT - Where's the counts?

Posted: Wed Nov 04, 2015 8:20 pm
by JimKnicely
I believe the row counts are stored in v_internal.vs_tables:

Code: Select all

dbadmin=> CREATE external TABLE test
dbadmin->     (
dbadmin(>         c1 INT,
dbadmin(>     )
dbadmin->      As Copy from 'webhdfs://testserver1:50070/apps/hive/warehouse/admin.db/test_orc_tst/*' On any node ORC;
CREATE TABLE

dbadmin=> SELECT name, rowcount FROM v_internal.vs_tables WHERE name = 'test';
 name | rowcount
------+----------
 test |       -1
(1 row)

dbadmin=> select analyze_external_row_count('test');
 analyze_external_row_count
----------------------------
                          0
(1 row)

dbadmin=> SELECT name, rowcount FROM v_internal.vs_tables WHERE name = 'test';
 name | rowcount
------+----------
 test |     1305
(1 row)

Re: ANALYZE_EXTERNAL_ROW_COUNT - Where's the counts?

Posted: Thu Nov 05, 2015 5:14 am
by NorbertKrupa
JimKnicely wrote:I believe the row counts are stored in v_internal.vs_tables
Nice find, Jim. I hope this gets into the documentation!