vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Probably a stupid question, but is there an easy way to determine how much a table has changed since last time stats where updated? What I'm trying to figure out is whether there is a need to do runstats on a particular table or not. Thanx /Lennart |
| |||
| Lennart wrote: > Probably a stupid question, but is there an easy way to determine how > much a table has changed since last time stats where updated? What I'm > trying to figure out is whether there is a need to do runstats on a > particular table or not. > > Thanx > /Lennart The DB2 Health monitor tracks this, but I don't think that this is externalized. But you could certainly leverage health monitor to notify you when it thinks a table needs to have its statistics updated. |
| |||
| Ian wrote: > Lennart wrote: >> Probably a stupid question, but is there an easy way to determine how >> much a table has changed since last time stats where updated? What I'm >> trying to figure out is whether there is a need to do runstats on a >> particular table or not. >> >> Thanx >> /Lennart > > The DB2 Health monitor tracks this, but I don't think that this is > externalized. But you could certainly leverage health monitor to > notify you when it thinks a table needs to have its statistics > updated. > And in DB2 9.5 you can leave it to DB2 end to end... Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| On Mar 19, 11:46 pm, Serge Rielau <srie...@ca.ibm.com> wrote: > Ian wrote: > > Lennart wrote: > >> Probably a stupid question, but is there an easy way to determine how > >> much a table has changed since last time stats where updated? What I'm > >> trying to figure out is whether there is a need to do runstats on a > >> particular table or not. > > >> Thanx > >> /Lennart > > > The DB2 Health monitor tracks this, but I don't think that this is > > externalized. But you could certainly leverage health monitor to > > notify you when it thinks a table needs to have its statistics > > updated. > > And in DB2 9.5 you can leave it to DB2 end to end... > Thank you Ian and Serge. /Lennart |
| ||||
| On Mar 19, 3:46 pm, Lennart <Erik.Lennart.Jons...@gmail.com> wrote: > Probably a stupid question, but is there an easy way to determine how > much a table has changed since last time stats where updated? What I'm > trying to figure out is whether there is a need to do runstats on a > particular table or not. > > Thanx > /Lennart The following may not work in all cases, might work best when a table has changed a lot and has really old statistics, but might be worth a try. If your systems are already on v9, then you should try Automatic Runstats. I have them set to ON on my production systems and they have been providing consistent worry-free maintenance. Look at a plan of a recently executed SQL that accesses the table. Above the table in question, you would see the card value for that table. Do a select count(1)/count(*) on the table and see how much it differs from the card value on the plan. If it differs by a lot then the table needs runstats. But this is only a case-by-case analysis when you are trying to fix a bad query that now takes longer than its supposed to. I don't think you can use this approach to prepare a regular maintenance plan. The frequency and amount of data change in tables can only be accessed properly by discussion with the application and data architects. Cheers, Sanjuro |