Shelby Cain <alyandon@yahoo.com> writes:
> It still decided to sample 150000 rows. Am I missing
> something obvious here? Shouldn't fewer rows be
> sampled when I set the collection target to 1?
The sample size is 300 rows times the largest per-column analysis
target, where default_statistics_target is used if the recorded
per-column setting is -1. I would say that you have set a target of 500
for at least one of the columns of that table, using ALTER TABLE SET
STATISTICS. Try this to see which:
select attname, attstattarget from pg_attribute
where attrelid = 'table_name_here'::regclass;
regards, tom lane