IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Last update date?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 178
Location: United States

PostPosted: Tue May 07, 2013 11:59 pm
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed May 08, 2013 12:07 am
Reply with quote

Table update means the structure of the table or the records in the table?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed May 08, 2013 12:09 am
Reply with quote

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
View user's profile Send private message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 178
Location: United States

PostPosted: Wed May 08, 2013 12:30 am
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed May 08, 2013 10:49 am
Reply with quote

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
View user's profile Send private message
Raghuraman_New

New User


Joined: 03 Oct 2008
Posts: 43
Location: Chennai,India.

PostPosted: Wed May 08, 2013 12:43 pm
Reply with quote

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
View user's profile Send private message
John Poulakos

Active User


Joined: 13 Jun 2012
Posts: 178
Location: United States

PostPosted: Wed May 08, 2013 11:28 pm
Reply with quote

Thanks a lot! Those last 2 answers will give me everything I need.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu May 09, 2013 1:13 pm
Reply with quote

Glad, we had been helpful.

Good Luck!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
No new posts Fetch data from programs execute (dat... DB2 3
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
Search our Forums:

Back to Top