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

Commit98376c1

Browse files
committed
Reduce duration of stats_ext regression tests
The regression tests of extended statistics were taking a fair amount oftime, due to using fairly large data sets with a couple thousand rows.So far this was fine, but with tests for statistics on expressions theduration would get a bit excessive. So reduce the size of some of thetests that will be used to test expressions, to keep the duration undercontrol. Done in a separate commit before adding the statistics onexpressions, to make it clear which estimates are expected to change.Author: Tomas VondraDiscussion:https://postgr.es/m/ad7891d2-e90c-b446-9fe2-7419143847d7%40enterprisedb.com
1 parent33e52ad commit98376c1

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -299,48 +299,48 @@ SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c
299299
TRUNCATE TABLE ndistinct;
300300
-- under-estimates when using only per-column statistics
301301
INSERT INTO ndistinct (a, b, c, filler1)
302-
SELECT mod(i,50), mod(i,51), mod(i,32),
303-
cash_words(mod(i,33)::int::money)
304-
FROM generate_series(1,5000) s(i);
302+
SELECT mod(i,13), mod(i,17), mod(i,19),
303+
cash_words(mod(i,23)::int::money)
304+
FROM generate_series(1,1000) s(i);
305305
ANALYZE ndistinct;
306306
SELECT s.stxkind, d.stxdndistinct
307307
FROM pg_statistic_ext s, pg_statistic_ext_data d
308308
WHERE s.stxrelid = 'ndistinct'::regclass
309309
AND d.stxoid = s.oid;
310-
stxkind |stxdndistinct
311-
---------+------------------------------------------------------------
312-
{d,f,m} | {"3, 4":2550, "3, 6":800, "4, 6":1632, "3, 4, 6":5000}
310+
stxkind | stxdndistinct
311+
---------+----------------------------------------------------------
312+
{d,f,m} | {"3, 4":221, "3, 6":247, "4, 6":323, "3, 4, 6":1000}
313313
(1 row)
314314

315315
-- correct estimates
316316
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b');
317317
estimated | actual
318318
-----------+--------
319-
2550|2550
319+
221| 221
320320
(1 row)
321321

322322
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c');
323323
estimated | actual
324324
-----------+--------
325-
5000 |5000
325+
1000 |1000
326326
(1 row)
327327

328328
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c, d');
329329
estimated | actual
330330
-----------+--------
331-
5000 |5000
331+
1000 |1000
332332
(1 row)
333333

334334
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d');
335335
estimated | actual
336336
-----------+--------
337-
1632|1632
337+
323| 323
338338
(1 row)
339339

340340
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, d');
341341
estimated | actual
342342
-----------+--------
343-
500 |50
343+
200 |13
344344
(1 row)
345345

346346
DROP STATISTICS s10;
@@ -356,31 +356,31 @@ SELECT s.stxkind, d.stxdndistinct
356356
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b');
357357
estimated | actual
358358
-----------+--------
359-
500 |2550
359+
100 | 221
360360
(1 row)
361361

362362
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c');
363363
estimated | actual
364364
-----------+--------
365-
500 |5000
365+
100 |1000
366366
(1 row)
367367

368368
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, b, c, d');
369369
estimated | actual
370370
-----------+--------
371-
500 |5000
371+
200 |1000
372372
(1 row)
373373

374374
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY b, c, d');
375375
estimated | actual
376376
-----------+--------
377-
500 |1632
377+
200 | 323
378378
(1 row)
379379

380380
SELECT * FROM check_estimated_rows('SELECT COUNT(*) FROM ndistinct GROUP BY a, d');
381381
estimated | actual
382382
-----------+--------
383-
500 |50
383+
200 |13
384384
(1 row)
385385

386386
-- functional dependencies tests
@@ -398,18 +398,18 @@ CREATE INDEX fdeps_ab_idx ON functional_dependencies (a, b);
398398
CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c);
399399
-- random data (no functional dependencies)
400400
INSERT INTO functional_dependencies (a, b, c, filler1)
401-
SELECT mod(i,23), mod(i,29), mod(i,31), i FROM generate_series(1,5000) s(i);
401+
SELECT mod(i,5), mod(i,7), mod(i,11), i FROM generate_series(1,1000) s(i);
402402
ANALYZE functional_dependencies;
403403
SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
404404
estimated | actual
405405
-----------+--------
406-
8| 8
406+
29|29
407407
(1 row)
408408

409409
SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1');
410410
estimated | actual
411411
-----------+--------
412-
1 |1
412+
3 |3
413413
(1 row)
414414

415415
-- create statistics
@@ -418,13 +418,13 @@ ANALYZE functional_dependencies;
418418
SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1''');
419419
estimated | actual
420420
-----------+--------
421-
8| 8
421+
29|29
422422
(1 row)
423423

424424
SELECT * FROM check_estimated_rows('SELECT * FROM functional_dependencies WHERE a = 1 AND b = ''1'' AND c = 1');
425425
estimated | actual
426426
-----------+--------
427-
1 |1
427+
3 |3
428428
(1 row)
429429

430430
-- a => b, a => c, b => c

‎src/test/regress/sql/stats_ext.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ TRUNCATE TABLE ndistinct;
194194

195195
-- under-estimates when using only per-column statistics
196196
INSERT INTO ndistinct (a, b, c, filler1)
197-
SELECT mod(i,50), mod(i,51), mod(i,32),
198-
cash_words(mod(i,33)::int::money)
199-
FROM generate_series(1,5000) s(i);
197+
SELECT mod(i,13), mod(i,17), mod(i,19),
198+
cash_words(mod(i,23)::int::money)
199+
FROM generate_series(1,1000) s(i);
200200

201201
ANALYZE ndistinct;
202202

@@ -251,7 +251,7 @@ CREATE INDEX fdeps_abc_idx ON functional_dependencies (a, b, c);
251251

252252
-- random data (no functional dependencies)
253253
INSERT INTO functional_dependencies (a, b, c, filler1)
254-
SELECT mod(i,23), mod(i,29), mod(i,31), iFROM generate_series(1,5000) s(i);
254+
SELECT mod(i,5), mod(i,7), mod(i,11), iFROM generate_series(1,1000) s(i);
255255

256256
ANALYZE functional_dependencies;
257257

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp