@@ -47,7 +47,6 @@ typedef struct vacuumingOptions
47
47
bool process_toast ;
48
48
bool skip_database_stats ;
49
49
char * buffer_usage_limit ;
50
- bool missing_only ;
51
50
} vacuumingOptions ;
52
51
53
52
/* object filter options */
@@ -129,7 +128,6 @@ main(int argc, char *argv[])
129
128
{"no-process-toast" , no_argument , NULL , 11 },
130
129
{"no-process-main" , no_argument , NULL , 12 },
131
130
{"buffer-usage-limit" , required_argument , NULL , 13 },
132
- {"missing-only" , no_argument , NULL , 14 },
133
131
{NULL , 0 , NULL , 0 }
134
132
};
135
133
@@ -277,9 +275,6 @@ main(int argc, char *argv[])
277
275
case 13 :
278
276
vacopts .buffer_usage_limit = escape_quotes (optarg );
279
277
break ;
280
- case 14 :
281
- vacopts .missing_only = true;
282
- break ;
283
278
default :
284
279
/* getopt_long already emitted a complaint */
285
280
pg_log_error_hint ("Try \"%s --help\" for more information." , progname );
@@ -365,11 +360,6 @@ main(int argc, char *argv[])
365
360
pg_fatal ("cannot use the \"%s\" option with the \"%s\" option" ,
366
361
"buffer-usage-limit" , "full" );
367
362
368
- /* Prohibit --missing-only without --analyze-only or --analyze-in-stages */
369
- if (vacopts .missing_only && !vacopts .analyze_only )
370
- pg_fatal ("cannot use the \"%s\" option without \"%s\" or \"%s\"" ,
371
- "missing-only" , "analyze-only" , "analyze-in-stages" );
372
-
373
363
/* fill cparams except for dbname, which is set below */
374
364
cparams .pghost = host ;
375
365
cparams .pgport = port ;
@@ -594,13 +584,6 @@ vacuum_one_database(ConnParams *cparams,
594
584
"--buffer-usage-limit" , "16" );
595
585
}
596
586
597
- if (vacopts -> missing_only && PQserverVersion (conn ) < 150000 )
598
- {
599
- PQfinish (conn );
600
- pg_fatal ("cannot use the \"%s\" option on server versions older than PostgreSQL %s" ,
601
- "--missing-only" , "15" );
602
- }
603
-
604
587
/* skip_database_stats is used automatically if server supports it */
605
588
vacopts -> skip_database_stats = (PQserverVersion (conn ) >= 160000 );
606
589
@@ -689,7 +672,6 @@ vacuum_one_database(ConnParams *cparams,
689
672
" FROM pg_catalog.pg_class c\n"
690
673
" JOIN pg_catalog.pg_namespace ns"
691
674
" ON c.relnamespace OPERATOR(pg_catalog.=) ns.oid\n"
692
- " CROSS JOIN LATERAL (SELECT c.relkind IN ('p', 'I')) as p (inherited)\n"
693
675
" LEFT JOIN pg_catalog.pg_class t"
694
676
" ON c.reltoastrelid OPERATOR(pg_catalog.=) t.oid\n" );
695
677
@@ -773,79 +755,6 @@ vacuum_one_database(ConnParams *cparams,
773
755
vacopts -> min_mxid_age );
774
756
}
775
757
776
- if (vacopts -> missing_only )
777
- {
778
- appendPQExpBufferStr (& catalog_query , " AND (\n" );
779
-
780
- /* regular stats */
781
- appendPQExpBufferStr (& catalog_query ,
782
- " EXISTS (SELECT NULL FROM pg_catalog.pg_attribute a\n"
783
- " WHERE a.attrelid OPERATOR(pg_catalog.=) c.oid\n"
784
- " AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
785
- " AND a.attnum OPERATOR(pg_catalog.>) 0::pg_catalog.int2\n"
786
- " AND NOT a.attisdropped\n"
787
- " AND a.attstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
788
- " AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic s\n"
789
- " WHERE s.starelid OPERATOR(pg_catalog.=) a.attrelid\n"
790
- " AND s.staattnum OPERATOR(pg_catalog.=) a.attnum\n"
791
- " AND s.stainherit OPERATOR(pg_catalog.=) p.inherited))\n" );
792
-
793
- /* extended stats */
794
- appendPQExpBufferStr (& catalog_query ,
795
- " OR EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext e\n"
796
- " WHERE e.stxrelid OPERATOR(pg_catalog.=) c.oid\n"
797
- " AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
798
- " AND e.stxstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
799
- " AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext_data d\n"
800
- " WHERE d.stxoid OPERATOR(pg_catalog.=) e.oid\n"
801
- " AND d.stxdinherit OPERATOR(pg_catalog.=) p.inherited))\n" );
802
-
803
- /* expression indexes */
804
- appendPQExpBufferStr (& catalog_query ,
805
- " OR EXISTS (SELECT NULL FROM pg_catalog.pg_index i\n"
806
- " CROSS JOIN LATERAL pg_catalog.unnest(i.indkey) WITH ORDINALITY u (attnum, ord)\n"
807
- " WHERE i.indrelid OPERATOR(pg_catalog.=) c.oid\n"
808
- " AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
809
- " AND i.indexprs IS NOT NULL\n"
810
- " AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic s\n"
811
- " WHERE s.starelid OPERATOR(pg_catalog.=) i.indexrelid\n"
812
- " AND s.staattnum OPERATOR(pg_catalog.=) u.ord\n"
813
- " AND s.stainherit OPERATOR(pg_catalog.=) p.inherited))\n" );
814
-
815
- /* table inheritance and regular stats */
816
- appendPQExpBufferStr (& catalog_query ,
817
- " OR EXISTS (SELECT NULL FROM pg_catalog.pg_attribute a\n"
818
- " WHERE a.attrelid OPERATOR(pg_catalog.=) c.oid\n"
819
- " AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
820
- " AND a.attnum OPERATOR(pg_catalog.>) 0::pg_catalog.int2\n"
821
- " AND NOT a.attisdropped\n"
822
- " AND a.attstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
823
- " AND c.relhassubclass\n"
824
- " AND NOT p.inherited\n"
825
- " AND EXISTS (SELECT NULL FROM pg_catalog.pg_inherits h\n"
826
- " WHERE h.inhparent OPERATOR(pg_catalog.=) c.oid)\n"
827
- " AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic s\n"
828
- " WHERE s.starelid OPERATOR(pg_catalog.=) a.attrelid\n"
829
- " AND s.staattnum OPERATOR(pg_catalog.=) a.attnum\n"
830
- " AND s.stainherit))\n" );
831
-
832
- /* table inheritance and extended stats */
833
- appendPQExpBufferStr (& catalog_query ,
834
- " OR EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext e\n"
835
- " WHERE e.stxrelid OPERATOR(pg_catalog.=) c.oid\n"
836
- " AND c.reltuples OPERATOR(pg_catalog.!=) 0::pg_catalog.float4\n"
837
- " AND e.stxstattarget IS DISTINCT FROM 0::pg_catalog.int2\n"
838
- " AND c.relhassubclass\n"
839
- " AND NOT p.inherited\n"
840
- " AND EXISTS (SELECT NULL FROM pg_catalog.pg_inherits h\n"
841
- " WHERE h.inhparent OPERATOR(pg_catalog.=) c.oid)\n"
842
- " AND NOT EXISTS (SELECT NULL FROM pg_catalog.pg_statistic_ext_data d\n"
843
- " WHERE d.stxoid OPERATOR(pg_catalog.=) e.oid\n"
844
- " AND d.stxdinherit))\n" );
845
-
846
- appendPQExpBufferStr (& catalog_query , " )\n" );
847
- }
848
-
849
758
/*
850
759
* Execute the catalog query. We use the default search_path for this
851
760
* query for consistency with table lookups done elsewhere by the user.
@@ -1272,7 +1181,6 @@ help(const char *progname)
1272
1181
printf (_ (" -j, --jobs=NUM use this many concurrent connections to vacuum\n" ));
1273
1182
printf (_ (" --min-mxid-age=MXID_AGE minimum multixact ID age of tables to vacuum\n" ));
1274
1183
printf (_ (" --min-xid-age=XID_AGE minimum transaction ID age of tables to vacuum\n" ));
1275
- printf (_ (" --missing-only only analyze relations with missing statistics\n" ));
1276
1184
printf (_ (" --no-index-cleanup don't remove index entries that point to dead tuples\n" ));
1277
1185
printf (_ (" --no-process-main skip the main relation\n" ));
1278
1186
printf (_ (" --no-process-toast skip the TOAST table associated with the table to vacuum\n" ));
0 commit comments