View previous topic :: View next topic
|
Author |
Message |
John Poulakos
Active User
Joined: 13 Jun 2012 Posts: 178 Location: United States
|
|
|
|
Forgive me if this is a dumb question, but I don't know where to look:
Is there an easy way to tell when a table was last updated, maybe in the system tables or something? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Table update means the structure of the table or the records in the table? |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
I believe that the DBAs and application developers would have to collaborate on that, the DBAs providing a table with a "last updated" column, the developers in keeping it current for modified rows. |
|
Back to top |
|
|
John Poulakos
Active User
Joined: 13 Jun 2012 Posts: 178 Location: United States
|
|
|
|
I meant records in the table. I thought there might be a better way than check for a last changed date column. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Just being nit-picky - there are rows in the DB2 Tables.
What release of DB2 are you using at your shop? By "updated", you did not mean - "loaded"?
With DB2 9.1 and above -- UPDATESTATSTIME in Real time statistics tables gets updated about 30 minutes after the last update/insert/delete/reorg. If you want "accuracy" - possibly this is not what you need; if accuracy is not concern - this might serve the purpose.
In DB 9 there is also a hidden row change timestamp even when you didn't define a column for it - issue a SELECT statement with the ROW CHANGE TIMESTAMP column in the column list. If a qualifying row does not have a value for the ROW CHANGE TIMESTAMP column, DB2 returns the time that the page in which that row resides was updated. |
|
Back to top |
|
|
Raghuraman_New
New User
Joined: 03 Oct 2008 Posts: 43 Location: Chennai,India.
|
|
|
|
John,
You can get the last updated time of a table using the SYSIBM.SYSTABLESPACESTATS table. You can get the info by using NAME(Table space name of the table) in SYSIBM.SYSTABLESPACESTATS. |
|
Back to top |
|
|
John Poulakos
Active User
Joined: 13 Jun 2012 Posts: 178 Location: United States
|
|
|
|
Thanks a lot! Those last 2 answers will give me everything I need. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Glad, we had been helpful.
Good Luck! |
|
Back to top |
|
|
|