Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf72d9a5

Browse files
committed
Remove redundant and ineffective test for btree insertion fast path.
indexing.sql's test for this feature was added along with thefeature in commit2b27273. However, shortly later that test wasrendered ineffective by commit074251d, which limited when theoptimization would be applied, so that the test didn't test it.Since then, commitdd299df added new tests (in btree_index.sql)that actually do test the feature. Code coverage comparisonsconfirm that this test sequence adds no meaningful coverage, andit's rather expensive, accounting for nearly half of the runtimeof indexing.sql according to my measurements. So let's remove it.Per advice from Peter Geoghegan.Discussion:https://postgr.es/m/735.1554935715@sss.pgh.pa.us
1 parent65d857d commitf72d9a5

File tree

2 files changed

+0
-347
lines changed

2 files changed

+0
-347
lines changed

‎src/test/regress/expected/indexing.out

Lines changed: 0 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,239 +1165,6 @@ select tableoid::regclass, * from idxpart order by a;
11651165
(8 rows)
11661166

11671167
drop table idxpart;
1168-
-- test fastpath mechanism for index insertion
1169-
create table fastpath (a int, b text, c numeric);
1170-
create unique index fpindex1 on fastpath(a);
1171-
insert into fastpath values (1, 'b1', 100.00);
1172-
insert into fastpath values (1, 'b1', 100.00); -- unique key check
1173-
ERROR: duplicate key value violates unique constraint "fpindex1"
1174-
DETAIL: Key (a)=(1) already exists.
1175-
truncate fastpath;
1176-
insert into fastpath select generate_series(1,10000), 'b', 100;
1177-
-- vacuum the table so as to improve chances of index-only scans. we can't
1178-
-- guarantee if index-only scans will be picked up in all cases or not, but
1179-
-- that fuzziness actually helps the test.
1180-
vacuum fastpath;
1181-
set enable_seqscan to false;
1182-
set enable_bitmapscan to false;
1183-
select sum(a) from fastpath where a = 6456;
1184-
sum
1185-
------
1186-
6456
1187-
(1 row)
1188-
1189-
select sum(a) from fastpath where a >= 5000 and a < 5700;
1190-
sum
1191-
---------
1192-
3744650
1193-
(1 row)
1194-
1195-
-- drop the only index on the table and compute hashes for
1196-
-- a few queries which orders the results in various different ways.
1197-
drop index fpindex1;
1198-
truncate fastpath;
1199-
insert into fastpath select y.x, 'b' || (y.x/10)::text, 100 from (select generate_series(1,10000) as x) y;
1200-
select md5(string_agg(a::text, b order by a, b asc)) from fastpath
1201-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1202-
md5
1203-
----------------------------------
1204-
2ca216010a558a52d7df12f76dfc77ab
1205-
(1 row)
1206-
1207-
select md5(string_agg(a::text, b order by a desc, b desc)) from fastpath
1208-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1209-
md5
1210-
----------------------------------
1211-
6167a852b3e0679886b84a5405b5b53d
1212-
(1 row)
1213-
1214-
select md5(string_agg(a::text, b order by b, a desc)) from fastpath
1215-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1216-
md5
1217-
----------------------------------
1218-
dfcf2bd5e5fea8397d47b2fd14618d31
1219-
(1 row)
1220-
1221-
select md5(string_agg(a::text, b order by b, a asc)) from fastpath
1222-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1223-
md5
1224-
----------------------------------
1225-
2ca216010a558a52d7df12f76dfc77ab
1226-
(1 row)
1227-
1228-
-- now create a multi-column index with both column asc
1229-
create index fpindex2 on fastpath(a, b);
1230-
truncate fastpath;
1231-
insert into fastpath select y.x, 'b' || (y.x/10)::text, 100 from (select generate_series(1,10000) as x) y;
1232-
-- again, vacuum here either forces index-only scans or creates fuzziness
1233-
vacuum fastpath;
1234-
select md5(string_agg(a::text, b order by a, b asc)) from fastpath
1235-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1236-
md5
1237-
----------------------------------
1238-
2ca216010a558a52d7df12f76dfc77ab
1239-
(1 row)
1240-
1241-
select md5(string_agg(a::text, b order by a desc, b desc)) from fastpath
1242-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1243-
md5
1244-
----------------------------------
1245-
6167a852b3e0679886b84a5405b5b53d
1246-
(1 row)
1247-
1248-
select md5(string_agg(a::text, b order by b, a desc)) from fastpath
1249-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1250-
md5
1251-
----------------------------------
1252-
dfcf2bd5e5fea8397d47b2fd14618d31
1253-
(1 row)
1254-
1255-
select md5(string_agg(a::text, b order by b, a asc)) from fastpath
1256-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1257-
md5
1258-
----------------------------------
1259-
2ca216010a558a52d7df12f76dfc77ab
1260-
(1 row)
1261-
1262-
-- same queries with a different kind of index now. the final result must not
1263-
-- change irrespective of what kind of index we have.
1264-
drop index fpindex2;
1265-
create index fpindex3 on fastpath(a desc, b asc);
1266-
truncate fastpath;
1267-
insert into fastpath select y.x, 'b' || (y.x/10)::text, 100 from (select generate_series(1,10000) as x) y;
1268-
vacuum fastpath;
1269-
select md5(string_agg(a::text, b order by a, b asc)) from fastpath
1270-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1271-
md5
1272-
----------------------------------
1273-
2ca216010a558a52d7df12f76dfc77ab
1274-
(1 row)
1275-
1276-
select md5(string_agg(a::text, b order by a desc, b desc)) from fastpath
1277-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1278-
md5
1279-
----------------------------------
1280-
6167a852b3e0679886b84a5405b5b53d
1281-
(1 row)
1282-
1283-
select md5(string_agg(a::text, b order by b, a desc)) from fastpath
1284-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1285-
md5
1286-
----------------------------------
1287-
dfcf2bd5e5fea8397d47b2fd14618d31
1288-
(1 row)
1289-
1290-
select md5(string_agg(a::text, b order by b, a asc)) from fastpath
1291-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1292-
md5
1293-
----------------------------------
1294-
2ca216010a558a52d7df12f76dfc77ab
1295-
(1 row)
1296-
1297-
-- repeat again
1298-
drop index fpindex3;
1299-
create index fpindex4 on fastpath(a asc, b desc);
1300-
truncate fastpath;
1301-
insert into fastpath select y.x, 'b' || (y.x/10)::text, 100 from (select generate_series(1,10000) as x) y;
1302-
vacuum fastpath;
1303-
select md5(string_agg(a::text, b order by a, b asc)) from fastpath
1304-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1305-
md5
1306-
----------------------------------
1307-
2ca216010a558a52d7df12f76dfc77ab
1308-
(1 row)
1309-
1310-
select md5(string_agg(a::text, b order by a desc, b desc)) from fastpath
1311-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1312-
md5
1313-
----------------------------------
1314-
6167a852b3e0679886b84a5405b5b53d
1315-
(1 row)
1316-
1317-
select md5(string_agg(a::text, b order by b, a desc)) from fastpath
1318-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1319-
md5
1320-
----------------------------------
1321-
dfcf2bd5e5fea8397d47b2fd14618d31
1322-
(1 row)
1323-
1324-
select md5(string_agg(a::text, b order by b, a asc)) from fastpath
1325-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1326-
md5
1327-
----------------------------------
1328-
2ca216010a558a52d7df12f76dfc77ab
1329-
(1 row)
1330-
1331-
-- and again, this time indexing by (b, a). Note that column "b" has non-unique
1332-
-- values.
1333-
drop index fpindex4;
1334-
create index fpindex5 on fastpath(b asc, a desc);
1335-
truncate fastpath;
1336-
insert into fastpath select y.x, 'b' || (y.x/10)::text, 100 from (select generate_series(1,10000) as x) y;
1337-
vacuum fastpath;
1338-
select md5(string_agg(a::text, b order by a, b asc)) from fastpath
1339-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1340-
md5
1341-
----------------------------------
1342-
2ca216010a558a52d7df12f76dfc77ab
1343-
(1 row)
1344-
1345-
select md5(string_agg(a::text, b order by a desc, b desc)) from fastpath
1346-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1347-
md5
1348-
----------------------------------
1349-
6167a852b3e0679886b84a5405b5b53d
1350-
(1 row)
1351-
1352-
select md5(string_agg(a::text, b order by b, a desc)) from fastpath
1353-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1354-
md5
1355-
----------------------------------
1356-
dfcf2bd5e5fea8397d47b2fd14618d31
1357-
(1 row)
1358-
1359-
select md5(string_agg(a::text, b order by b, a asc)) from fastpath
1360-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1361-
md5
1362-
----------------------------------
1363-
2ca216010a558a52d7df12f76dfc77ab
1364-
(1 row)
1365-
1366-
-- one last time
1367-
drop index fpindex5;
1368-
create index fpindex6 on fastpath(b desc, a desc);
1369-
truncate fastpath;
1370-
insert into fastpath select y.x, 'b' || (y.x/10)::text, 100 from (select generate_series(1,10000) as x) y;
1371-
vacuum fastpath;
1372-
select md5(string_agg(a::text, b order by a, b asc)) from fastpath
1373-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1374-
md5
1375-
----------------------------------
1376-
2ca216010a558a52d7df12f76dfc77ab
1377-
(1 row)
1378-
1379-
select md5(string_agg(a::text, b order by a desc, b desc)) from fastpath
1380-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1381-
md5
1382-
----------------------------------
1383-
6167a852b3e0679886b84a5405b5b53d
1384-
(1 row)
1385-
1386-
select md5(string_agg(a::text, b order by b, a desc)) from fastpath
1387-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1388-
md5
1389-
----------------------------------
1390-
dfcf2bd5e5fea8397d47b2fd14618d31
1391-
(1 row)
1392-
1393-
select md5(string_agg(a::text, b order by b, a asc)) from fastpath
1394-
where a >= 1000 and a < 2000 and b > 'b1' and b < 'b3';
1395-
md5
1396-
----------------------------------
1397-
2ca216010a558a52d7df12f76dfc77ab
1398-
(1 row)
1399-
1400-
drop table fastpath;
14011168
-- intentionally leave some objects around
14021169
create table idxpart (a int) partition by range (a);
14031170
create table idxpart1 partition of idxpart for values from (0) to (100);

‎src/test/regress/sql/indexing.sql

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -620,120 +620,6 @@ insert into idxpart values (857142, 'six');
620620
select tableoid::regclass,*from idxpartorder by a;
621621
droptable idxpart;
622622

623-
-- test fastpath mechanism for index insertion
624-
createtablefastpath (aint, btext, cnumeric);
625-
createunique indexfpindex1on fastpath(a);
626-
627-
insert into fastpathvalues (1,'b1',100.00);
628-
insert into fastpathvalues (1,'b1',100.00);-- unique key check
629-
630-
truncate fastpath;
631-
insert into fastpathselect generate_series(1,10000),'b',100;
632-
633-
-- vacuum the table so as to improve chances of index-only scans. we can't
634-
-- guarantee if index-only scans will be picked up in all cases or not, but
635-
-- that fuzziness actually helps the test.
636-
vacuum fastpath;
637-
638-
set enable_seqscan to false;
639-
set enable_bitmapscan to false;
640-
641-
selectsum(a)from fastpathwhere a=6456;
642-
selectsum(a)from fastpathwhere a>=5000and a<5700;
643-
644-
-- drop the only index on the table and compute hashes for
645-
-- a few queries which orders the results in various different ways.
646-
dropindex fpindex1;
647-
truncate fastpath;
648-
insert into fastpathselecty.x,'b'|| (y.x/10)::text,100from (select generate_series(1,10000)as x) y;
649-
select md5(string_agg(a::text, border by a, basc))from fastpath
650-
where a>=1000and a<2000and b>'b1'and b<'b3';
651-
select md5(string_agg(a::text, border by adesc, bdesc))from fastpath
652-
where a>=1000and a<2000and b>'b1'and b<'b3';
653-
select md5(string_agg(a::text, border by b, adesc))from fastpath
654-
where a>=1000and a<2000and b>'b1'and b<'b3';
655-
select md5(string_agg(a::text, border by b, aasc))from fastpath
656-
where a>=1000and a<2000and b>'b1'and b<'b3';
657-
658-
-- now create a multi-column index with both column asc
659-
createindexfpindex2on fastpath(a, b);
660-
truncate fastpath;
661-
insert into fastpathselecty.x,'b'|| (y.x/10)::text,100from (select generate_series(1,10000)as x) y;
662-
-- again, vacuum here either forces index-only scans or creates fuzziness
663-
vacuum fastpath;
664-
select md5(string_agg(a::text, border by a, basc))from fastpath
665-
where a>=1000and a<2000and b>'b1'and b<'b3';
666-
select md5(string_agg(a::text, border by adesc, bdesc))from fastpath
667-
where a>=1000and a<2000and b>'b1'and b<'b3';
668-
select md5(string_agg(a::text, border by b, adesc))from fastpath
669-
where a>=1000and a<2000and b>'b1'and b<'b3';
670-
select md5(string_agg(a::text, border by b, aasc))from fastpath
671-
where a>=1000and a<2000and b>'b1'and b<'b3';
672-
673-
-- same queries with a different kind of index now. the final result must not
674-
-- change irrespective of what kind of index we have.
675-
dropindex fpindex2;
676-
createindexfpindex3on fastpath(adesc, basc);
677-
truncate fastpath;
678-
insert into fastpathselecty.x,'b'|| (y.x/10)::text,100from (select generate_series(1,10000)as x) y;
679-
vacuum fastpath;
680-
select md5(string_agg(a::text, border by a, basc))from fastpath
681-
where a>=1000and a<2000and b>'b1'and b<'b3';
682-
select md5(string_agg(a::text, border by adesc, bdesc))from fastpath
683-
where a>=1000and a<2000and b>'b1'and b<'b3';
684-
select md5(string_agg(a::text, border by b, adesc))from fastpath
685-
where a>=1000and a<2000and b>'b1'and b<'b3';
686-
select md5(string_agg(a::text, border by b, aasc))from fastpath
687-
where a>=1000and a<2000and b>'b1'and b<'b3';
688-
689-
-- repeat again
690-
dropindex fpindex3;
691-
createindexfpindex4on fastpath(aasc, bdesc);
692-
truncate fastpath;
693-
insert into fastpathselecty.x,'b'|| (y.x/10)::text,100from (select generate_series(1,10000)as x) y;
694-
vacuum fastpath;
695-
select md5(string_agg(a::text, border by a, basc))from fastpath
696-
where a>=1000and a<2000and b>'b1'and b<'b3';
697-
select md5(string_agg(a::text, border by adesc, bdesc))from fastpath
698-
where a>=1000and a<2000and b>'b1'and b<'b3';
699-
select md5(string_agg(a::text, border by b, adesc))from fastpath
700-
where a>=1000and a<2000and b>'b1'and b<'b3';
701-
select md5(string_agg(a::text, border by b, aasc))from fastpath
702-
where a>=1000and a<2000and b>'b1'and b<'b3';
703-
704-
-- and again, this time indexing by (b, a). Note that column "b" has non-unique
705-
-- values.
706-
dropindex fpindex4;
707-
createindexfpindex5on fastpath(basc, adesc);
708-
truncate fastpath;
709-
insert into fastpathselecty.x,'b'|| (y.x/10)::text,100from (select generate_series(1,10000)as x) y;
710-
vacuum fastpath;
711-
select md5(string_agg(a::text, border by a, basc))from fastpath
712-
where a>=1000and a<2000and b>'b1'and b<'b3';
713-
select md5(string_agg(a::text, border by adesc, bdesc))from fastpath
714-
where a>=1000and a<2000and b>'b1'and b<'b3';
715-
select md5(string_agg(a::text, border by b, adesc))from fastpath
716-
where a>=1000and a<2000and b>'b1'and b<'b3';
717-
select md5(string_agg(a::text, border by b, aasc))from fastpath
718-
where a>=1000and a<2000and b>'b1'and b<'b3';
719-
720-
-- one last time
721-
dropindex fpindex5;
722-
createindexfpindex6on fastpath(bdesc, adesc);
723-
truncate fastpath;
724-
insert into fastpathselecty.x,'b'|| (y.x/10)::text,100from (select generate_series(1,10000)as x) y;
725-
vacuum fastpath;
726-
select md5(string_agg(a::text, border by a, basc))from fastpath
727-
where a>=1000and a<2000and b>'b1'and b<'b3';
728-
select md5(string_agg(a::text, border by adesc, bdesc))from fastpath
729-
where a>=1000and a<2000and b>'b1'and b<'b3';
730-
select md5(string_agg(a::text, border by b, adesc))from fastpath
731-
where a>=1000and a<2000and b>'b1'and b<'b3';
732-
select md5(string_agg(a::text, border by b, aasc))from fastpath
733-
where a>=1000and a<2000and b>'b1'and b<'b3';
734-
735-
droptable fastpath;
736-
737623
-- intentionally leave some objects around
738624
createtableidxpart (aint) partition by range (a);
739625
createtableidxpart1 partition of idxpart forvaluesfrom (0) to (100);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp