Skip to main content
Question

Analyze statistics on a table loaded multiple times

  • January 15, 2019
  • 2 replies
  • 22 views

mkheir
Forum|alt.badge.img+1
  • Participating Frequently

Hello Experts,

I need to load a table from three different staging tables.
Each of the three source staging tables have data from a subsidiary and can be ready for load into the final table independently. so they can happen on different moments or in parallel.

I need help on how to plan the ANALYZE_STATISTICS on the final table:

  • After each data load:
    Pros : easy to schedule after each subsidiary batch load.
    Cons: The issue is that it may happen that while an analyze statistics is running on the table, others (ANALYZE_STATISTICS on the same table) can be triggered, errors will be reported as only one ANALYZE_STATISTICS can be running on a table at a time.

  • Once after the three subsidiaries have been loaded:
    Pros : Efficient use of ANALYZE_STATISTICS
    Cons : If for any reason one subsidiary have a problem and miss a daily load, the analyze statistics will not be triggered and queries performances may be impacted (?).

How can we manage this, any other suggestion is welcome.

Many thanks.
Mkheir.

2 replies

mflower
Forum|alt.badge.img
  • Participating Frequently
  • January 16, 2019

Could you create an extra table in the database, which logs the completed data load operations.
eg After data load_A
insert into load_table values ('load_A', getdate() ); COMMIT;

Then setup a crontab which runs (say every 10 mins)
The crontab will only run analyze_statistics when the state of the load_table is valid
(and perhaps afterwards, truncate the load_table)


Vertica_Curtis
Forum|alt.badge.img+1
  • Participating Frequently
  • January 16, 2019

I think the easy solution is to just schedule the analyze in the middle of the night when the process isn't running. I've never personally seen a situation where not having statistics has a significant impact on performance one way or the other, so I don't tend to place a high value on running it.