The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Copy Table History

Jim_KnicelyJim_Knicely - Select Field - Administrator
edited December 2018 in Tips from the Team

The COPY_TABLE function copies one table to another… FAST!

Down the road I might want to know if a table was created as a copy using the COPY_TABLE function. To find out, I can query the data collector table DC_COPY_TABLES.


dbadmin=> SELECT COUNT(*) FROM big_fact;
(1 row)

dbadmin=> \timing on
Timing is on.

dbadmin=> SELECT copy_table('big_fact', 'big_fact_copy');
Created table big_fact_copy.
Copied table big_fact to big_fact_copy

(1 row)

Time: First fetch (1 row): 179.852 ms. All rows formatted: 179.901 ms

dbadmin=> \timing off
Timing is off.

dbadmin=> SELECT table_name, description
dbadmin->   FROM data_collector
dbadmin->  WHERE component = 'CopyTables';
   table_name   |                       description
dc_copy_tables | History of all tables copied by copy_table meta-function
(1 row)

dbadmin=> SELECT * FROM dc_copy_tables;
             time              |     node_name      | from_table |   to_table    | commit_epoch | table_created
2018-12-10 08:10:37.086735-05 | v_test_db_node0001 | big_fact   | big_fact_copy |         2606 | t
(1 row)

Helpful Links:

Have fun!

Sign In or Register to comment.