@@ -851,9 +851,7 @@ DROP EXTENSION pg_pathman;
851
851
*/
852
852
CREATE SCHEMA calamity;
853
853
CREATE EXTENSION pg_pathman;
854
- /* Change this setting for code coverage */
855
- SET pg_pathman.enable_bounds_cache = false;
856
- /* check view pathman_cache_stats */
854
+ /* check that cache loading is lazy */
857
855
CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
858
856
SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
859
857
create_range_partitions
@@ -870,22 +868,54 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
870
868
partition parents cache | 0
871
869
(4 rows)
872
870
873
- SELECT drop_partitions('calamity.test_pathman_cache_stats');
874
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_1
875
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_2
876
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_3
877
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_4
878
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_5
879
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_6
880
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_7
881
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_8
882
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_9
883
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_10
884
- drop_partitions
885
- -----------------
886
- 10
871
+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
872
+ NOTICE: drop cascades to 11 other objects
873
+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
874
+ context | entries
875
+ --------------------------+---------
876
+ maintenance | 0
877
+ partition bounds cache | 0
878
+ partition dispatch cache | 0
879
+ partition parents cache | 0
880
+ (4 rows)
881
+
882
+ /* Change this setting for code coverage */
883
+ SET pg_pathman.enable_bounds_cache = false;
884
+ /* check view pathman_cache_stats (bounds cache disabled) */
885
+ CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
886
+ SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
887
+ create_range_partitions
888
+ -------------------------
889
+ 10
887
890
(1 row)
888
891
892
+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
893
+ QUERY PLAN
894
+ -----------------------------------------------
895
+ Append
896
+ -> Seq Scan on test_pathman_cache_stats_1
897
+ -> Seq Scan on test_pathman_cache_stats_2
898
+ -> Seq Scan on test_pathman_cache_stats_3
899
+ -> Seq Scan on test_pathman_cache_stats_4
900
+ -> Seq Scan on test_pathman_cache_stats_5
901
+ -> Seq Scan on test_pathman_cache_stats_6
902
+ -> Seq Scan on test_pathman_cache_stats_7
903
+ -> Seq Scan on test_pathman_cache_stats_8
904
+ -> Seq Scan on test_pathman_cache_stats_9
905
+ -> Seq Scan on test_pathman_cache_stats_10
906
+ (11 rows)
907
+
908
+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
909
+ context | entries
910
+ --------------------------+---------
911
+ maintenance | 0
912
+ partition bounds cache | 0
913
+ partition dispatch cache | 1
914
+ partition parents cache | 10
915
+ (4 rows)
916
+
917
+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
918
+ NOTICE: drop cascades to 11 other objects
889
919
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
890
920
context | entries
891
921
--------------------------+---------
@@ -895,42 +925,102 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
895
925
partition parents cache | 0
896
926
(4 rows)
897
927
898
- DROP TABLE calamity.test_pathman_cache_stats;
899
928
/* Restore this GUC */
900
929
SET pg_pathman.enable_bounds_cache = true;
901
- /* check view pathman_cache_stats (one more time ) */
930
+ /* check view pathman_cache_stats (bounds cache enabled ) */
902
931
CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
903
932
SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
904
933
create_range_partitions
905
934
-------------------------
906
935
10
907
936
(1 row)
908
937
938
+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
939
+ QUERY PLAN
940
+ -----------------------------------------------
941
+ Append
942
+ -> Seq Scan on test_pathman_cache_stats_1
943
+ -> Seq Scan on test_pathman_cache_stats_2
944
+ -> Seq Scan on test_pathman_cache_stats_3
945
+ -> Seq Scan on test_pathman_cache_stats_4
946
+ -> Seq Scan on test_pathman_cache_stats_5
947
+ -> Seq Scan on test_pathman_cache_stats_6
948
+ -> Seq Scan on test_pathman_cache_stats_7
949
+ -> Seq Scan on test_pathman_cache_stats_8
950
+ -> Seq Scan on test_pathman_cache_stats_9
951
+ -> Seq Scan on test_pathman_cache_stats_10
952
+ (11 rows)
953
+
909
954
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
910
955
context | entries
911
956
--------------------------+---------
912
957
maintenance | 0
913
- partition bounds cache | 0
958
+ partition bounds cache | 10
914
959
partition dispatch cache | 1
960
+ partition parents cache | 10
961
+ (4 rows)
962
+
963
+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
964
+ NOTICE: drop cascades to 11 other objects
965
+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
966
+ context | entries
967
+ --------------------------+---------
968
+ maintenance | 0
969
+ partition bounds cache | 0
970
+ partition dispatch cache | 0
915
971
partition parents cache | 0
916
972
(4 rows)
917
973
918
- SELECT drop_partitions('calamity.test_pathman_cache_stats');
919
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_1
920
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_2
921
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_3
922
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_4
923
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_5
924
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_6
925
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_7
926
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_8
927
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_9
928
- NOTICE: 0 rows copied from calamity.test_pathman_cache_stats_10
929
- drop_partitions
930
- -----------------
931
- 10
974
+ /* check that parents cache has been flushed after partition was dropped */
975
+ CREATE TABLE calamity.test_pathman_cache_stats(val NUMERIC NOT NULL);
976
+ SELECT create_range_partitions('calamity.test_pathman_cache_stats', 'val', 1, 10, 10);
977
+ create_range_partitions
978
+ -------------------------
979
+ 10
932
980
(1 row)
933
981
982
+ EXPLAIN (COSTS OFF) SELECT * FROM calamity.test_pathman_cache_stats;
983
+ QUERY PLAN
984
+ -----------------------------------------------
985
+ Append
986
+ -> Seq Scan on test_pathman_cache_stats_1
987
+ -> Seq Scan on test_pathman_cache_stats_2
988
+ -> Seq Scan on test_pathman_cache_stats_3
989
+ -> Seq Scan on test_pathman_cache_stats_4
990
+ -> Seq Scan on test_pathman_cache_stats_5
991
+ -> Seq Scan on test_pathman_cache_stats_6
992
+ -> Seq Scan on test_pathman_cache_stats_7
993
+ -> Seq Scan on test_pathman_cache_stats_8
994
+ -> Seq Scan on test_pathman_cache_stats_9
995
+ -> Seq Scan on test_pathman_cache_stats_10
996
+ (11 rows)
997
+
998
+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
999
+ context | entries
1000
+ --------------------------+---------
1001
+ maintenance | 0
1002
+ partition bounds cache | 10
1003
+ partition dispatch cache | 1
1004
+ partition parents cache | 10
1005
+ (4 rows)
1006
+
1007
+ SELECT drop_range_partition('calamity.test_pathman_cache_stats_1');
1008
+ drop_range_partition
1009
+ -------------------------------------
1010
+ calamity.test_pathman_cache_stats_1
1011
+ (1 row)
1012
+
1013
+ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
1014
+ context | entries
1015
+ --------------------------+---------
1016
+ maintenance | 0
1017
+ partition bounds cache | 9
1018
+ partition dispatch cache | 1
1019
+ partition parents cache | 0
1020
+ (4 rows)
1021
+
1022
+ DROP TABLE calamity.test_pathman_cache_stats CASCADE;
1023
+ NOTICE: drop cascades to 10 other objects
934
1024
SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
935
1025
context | entries
936
1026
--------------------------+---------
@@ -940,7 +1030,6 @@ SELECT context, entries FROM pathman_cache_stats ORDER BY context; /* OK */
940
1030
partition parents cache | 0
941
1031
(4 rows)
942
1032
943
- DROP TABLE calamity.test_pathman_cache_stats;
944
1033
DROP SCHEMA calamity CASCADE;
945
1034
DROP EXTENSION pg_pathman;
946
1035
/*
0 commit comments