Skip to main content

Is there a monitoring table available with the last-touch timestamp for a table?

  • April 20, 2013
  • 6 replies
  • 28 views

EugeneAbovsky
Is it possible to somehow find out the last-touch time for a table in vertica, possibly via some kind of a monitor table? The use case I am trying to solve for is when using some "cache" type tables for reports which I want to linger while their being active, but if no query's touched the table for X amount of time, I want to have a garbage-collection procedure drop the table.

6 replies

Forum|alt.badge.img+2
  • Participating Frequently
  • April 20, 2013
If you're willing to do a little computation, Vertica does provide some usage information at the projection level. Once you know the projections, you can figure out what tables those projections belong to with some system table queries. You might want to take a look through the documentation of Vertica's monitoring APIs; they list all the tables that you can use to do this sort of thing: https://my.vertica.com/docs/CE/6.0.1/HTML/index.htm#9338.htm Let us know if you can figure out how to do what you'd like to do from there.

Forum|alt.badge.img+2
  • Participating Frequently
  • April 23, 2013
Hello: You may find the table query_requests monitoring table helpful. You could specify the request_type as QUERY, and possibly check the timestamp info. Here's the basic output with select * from query_requests: ---------------------------------------------------------------- node_name | v_vmart_node0003 user_name | dbadmin session_id | node03-6456:0x2e59 request_id | 1 transaction_id | 54043195528456874 statement_id | 1 request_type | QUERY request | select * from vs_nodes; request_label | search_path | "$user", public, v_catalog, v_monitor, v_internal memory_acquired_mb | 100 success | t error_count | start_timestamp | 2012-12-02 13:51:31.048956-05 end_timestamp | 2012-12-02 13:51:32.719739-05 request_duration_ms | 1671 is_executing | f

EugeneAbovsky
  • Author
  • New Participant
  • April 23, 2013
I like Adam's answer a bit better - the query_requests monitoring table would be useful if it actually had some information on used tables or projections in the columns - not having that makes it much less useful for this use case. Getting to the table name by first looking at the projection_usage monitoring table then looking up the table name via v_catalog.projections seems to be the ticket. Thanks

Forum|alt.badge.img+2
  • Participating Frequently
  • April 23, 2013
OK: glad Adam helped.

Rama_Rao_Samamo
why not querying epoch value on the given table?

select max(epoch) from <table_name>;

But I am not sure if there is way to convert the epoch value to timestamp.

eyalush
  • New Participant
  • October 8, 2015

Hi,

I am looking to see last used (if possible select/insert/update) tables.

 

We have many Schemas and tables but alot of them are junk and not in used.

 

Does anyone have a script to identify or Show activity on Tables?

 

I am guessing I am not the first one :)

 

thanks,

Eyal