To add something...:

The first rule is to use histograms only if you understand well what they are and used for.

I have noticed that it is risky to make histograms for all columns, I have used them only for columns having a high degree of skew data.

The basic rules are not to use histograms

1. If the column is unique and used with =.

2. If you do not have that column in where statements.

3. If the column is uniformly distributed.

Try to understand the rules for choosing the sample size when analyzing (for example with histograms the number of sample rows must be > 100 times the number of buckets, etc). Then you should know how to choose the number of buckets, etc.

I do not use histograms for the predicates on the columns in our applications often use bind variables. During testing with histograms the applications was slower than without histograms.