Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce transparent_decompress_chunk flakiness #6550

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

akuzm
Copy link
Member

@akuzm akuzm commented Jan 19, 2024

Add ANALYZE after compression of metrics_compressed in shared test setup.

ci_stats=# select distinct on (log_contents) count(*) over (partition by log_contents), * from test natural join log where test_name like 'transparent_decompress%' and test_status not in ('ok', 'failed (ignored)') and job_date > now() - interval '2 week';
─[ RECORD 1 ]─┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 6
job_date      │ 2024-01-22 00:13:30.478982+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1878
log_contents  │ c 0001: @@ -204,10 +204,10 @@                                                                                                   ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0010: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v1)                                                                          ↵
              │ p 0013:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)
─[ RECORD 2 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-22 11:43:38.432916+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1746
log_contents  │ c 0001: @@ -204,10 +204,10 @@                                                                                                   ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0010: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v1)                                                                          ↵
              │ p 0013:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)                        ↵
              │ b 0014: @@ -351,10 +351,10 @@                                                                                                   ↵
              │ b 0015:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0016:           Workers Planned: 2                                                                                            ↵
              │ b 0017:           Workers Launched: 2                                                                                           ↵
              │ c 0018: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0019: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0020:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0021:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0022: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0023: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0024:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0025:                       Filter: (device_id < v0)                                                                          ↵
              │ p 0026:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)                        ↵
              │ b 0027: @@ -429,9 +429,9 @@                                                                                                     ↵
              │ b 0028:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0029:           Workers Planned: 2                                                                                            ↵
              │ b 0030:           Workers Launched: 2                                                                                           ↵
              │ c 0031: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0032: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0033:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0034: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0035: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0036:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0037:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0038:                       Vectorized Filter: ("time" < now())
─[ RECORD 3 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-18 13:42:28.569317+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 2367
log_contents  │ c 0001: @@ -204,7 +204,7 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=8 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0009:                 Worker 1:  Sort Method: top-N heapsort 
─[ RECORD 4 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-23 09:22:34.799587+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1837
log_contents  │ c 0001: @@ -204,9 +204,9 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0008: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0010:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v1)                                                                          ↵
              │ b 0013: @@ -351,10 +351,10 @@                                                                                                   ↵
              │ b 0014:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0015:           Workers Planned: 2                                                                                            ↵
              │ b 0016:           Workers Launched: 2                                                                                           ↵
              │ c 0017: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0018: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0019:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0020:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0021: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0022: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0023:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0024:                       Filter: (device_id < v0)                                                                          ↵
              │ p 0025:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)
─[ RECORD 5 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-19 16:55:14.434146+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1765
log_contents  │ c 0001: @@ -204,9 +204,9 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0008: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0010:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v1)                                                                          ↵
              │ b 0013: @@ -429,10 +429,10 @@                                                                                                   ↵
              │ b 0014:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0015:           Workers Planned: 2                                                                                            ↵
              │ b 0016:           Workers Launched: 2                                                                                           ↵
              │ c 0017: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0018: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0019:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0020:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0021: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0022: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0023:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0024:                       Vectorized Filter: ("time" < now())                                                               ↵
              │ p 0025:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)
─[ RECORD 6 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 2
job_date      │ 2024-01-19 17:13:58.262968+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1884
log_contents  │ c 0001: @@ -204,9 +204,9 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0008: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0010:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v1)                                                                          ↵
              │ b 0013: @@ -429,9 +429,9 @@                                                                                                     ↵
              │ b 0014:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0015:           Workers Planned: 2                                                                                            ↵
              │ b 0016:           Workers Launched: 2                                                                                           ↵
              │ c 0017: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0018: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0019:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0020: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0021: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0022:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0023:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0024:                       Vectorized Filter: ("time" < now())
─[ RECORD 7 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 5
job_date      │ 2024-01-18 00:13:06.827031+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1907
log_contents  │ c 0001: @@ -351,10 +351,10 @@                                                                                                   ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0010: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v0)                                                                          ↵
              │ p 0013:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)
─[ RECORD 8 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 2
job_date      │ 2024-01-17 19:44:19.124602+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1832
log_contents  │ c 0001: @@ -351,10 +351,10 @@                                                                                                   ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0010: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v0)                                                                          ↵
              │ p 0013:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)                        ↵
              │ b 0014: @@ -429,10 +429,10 @@                                                                                                   ↵
              │ b 0015:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0016:           Workers Planned: 2                                                                                            ↵
              │ b 0017:           Workers Launched: 2                                                                                           ↵
              │ c 0018: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0019: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0020:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0021:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0022: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0023: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0024:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0025:                       Vectorized Filter: ("time" < now())                                                               ↵
              │ p 0026:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)
─[ RECORD 9 ]─┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-23 11:57:56.386946+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1880
log_contents  │ c 0001: @@ -351,10 +351,10 @@                                                                                                   ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0010: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v0)                                                                          ↵
              │ p 0013:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)                        ↵
              │ b 0014: @@ -429,9 +429,9 @@                                                                                                     ↵
              │ b 0015:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ b 0016:           Workers Planned: 2                                                                                            ↵
              │ b 0017:           Workers Launched: 2                                                                                           ↵
              │ c 0018: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0019: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0020:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0021: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0022: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0023:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0024:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0025:                       Vectorized Filter: ("time" < now())
─[ RECORD 10 ]┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-19 18:48:58.141499+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 2196
log_contents  │ c 0001: @@ -351,7 +351,7 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=6 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0009:                 Worker 1:  Sort Method: top-N heapsort 
─[ RECORD 11 ]┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 4
job_date      │ 2024-01-19 00:12:57.56003+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 1740
log_contents  │ c 0001: @@ -351,9 +351,9 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0008: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0010:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Filter: (device_id < v0)
─[ RECORD 12 ]┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 3
job_date      │ 2024-01-22 08:28:28.294296+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 2310
log_contents  │ c 0001: @@ -429,10 +429,10 @@                                                                                                   ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ p 0008:                 Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: -               Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0010: +               Worker 1:  Sort Method: quicksort                                                                       ↵
              │ c 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Vectorized Filter: ("time" < now())                                                               ↵
              │ p 0013:                       ->  Parallel Seq Scan on compress_hyper_X_X_chunk (actual rows=10 loops=2)
─[ RECORD 13 ]┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 2
job_date      │ 2024-01-23 12:03:41.721988+00
test_name     │ transparent_decompress_chunk-13
test_status   │ failed
test_duration │ 2320
log_contents  │ c 0001: @@ -429,9 +429,9 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0008: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0010:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Vectorized Filter: ("time" < now())
─[ RECORD 14 ]┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 1
job_date      │ 2024-01-23 10:31:36.058796+00
test_name     │ transparent_decompress_chunk-15
test_status   │ failed
test_duration │ 405
log_contents  │ c 0001: @@ -431,9 +431,9 @@                                                                                                     ↵
              │ p 0002:     ->  Gather Merge (actual rows=10 loops=1)                                                                           ↵
              │ p 0003:           Workers Planned: 2                                                                                            ↵
              │ b 0004:           Workers Launched: 2                                                                                           ↵
              │ c 0005: -         ->  Sort (actual rows=10 loops=2)                                                                             ↵
              │ c 0006: +         ->  Sort (actual rows=5 loops=2)                                                                              ↵
              │ c 0007:                 Sort Key: _hyper_X_X_chunk."time", _hyper_X_X_chunk.device_id                                           ↵
              │ c 0008: -               Worker 0:  Sort Method: top-N heapsort                                                                  ↵
              │ c 0009: +               Worker 0:  Sort Method: quicksort                                                                       ↵
              │ c 0010:                 Worker 1:  Sort Method: top-N heapsort                                                                  ↵
              │ p 0011:                 ->  Custom Scan (DecompressChunk) on _hyper_X_X_chunk (actual rows=8995 loops=2)                        ↵
              │ p 0012:                       Vectorized Filter: ("time" < now())
─[ RECORD 15 ]┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
count         │ 2
job_date      │ 2024-01-11 00:37:51.195329+00
test_name     │ transparent_decompress_chunk-14
test_status   │ failed
test_duration │ 790
log_contents  │ c 0001: @@ -759,24 +759,24 @@                                                                                                   ↵
              │ p 0002:  QUERY PLAN                                                                                                             ↵
              │ p 0003:   Limit                                                                                                                 ↵
              │ b 0004:     ->  Merge Join                                                                                                      ↵
              │ c 0005: -         Merge Cond: (m1."time" = m2."time")                                                                           ↵
              │ p 0006: -         ->  Custom Scan (ChunkAppend) on metrics m1                                                                   ↵
              │ p 0007: -               Order: m1."time"                                                                                        ↵
              │ b 0008: -               ->  Index Scan Backward using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk m1_1      ↵
              │ b 0009: -                     Index Cond: (device_id = 1)                                                                       ↵
              │ b 0010: -               ->  Index Scan Backward using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk m1_2      ↵
              │ b 0011: -                     Index Cond: (device_id = 1)                                                                       ↵
              │ b 0012: -               ->  Index Scan Backward using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk m1_3      ↵
              │ b 0013: -                     Index Cond: (device_id = 1)                                                                       ↵
              │ c 0014: +         Merge Cond: (m2."time" = m1."time")                                                                           ↵
              │ p 0015: +         ->  Custom Scan (ChunkAppend) on metrics_space m2                                                             ↵
              │ p 0016: +               Order: m2."time"                                                                                        ↵
              │ b 0017: +               ->  Index Scan using _hyper_X_X_chunk_metrics_space_device_id_time_idx on _hyper_X_X_chunk m2_1         ↵
              │ b 0018: +                     Index Cond: (device_id = 2)                                                                       ↵
              │ b 0019: +               ->  Index Scan using _hyper_X_X_chunk_metrics_space_device_id_time_idx on _hyper_X_X_chunk m2_2         ↵
              │ b 0020: +                     Index Cond: (device_id = 2)                                                                       ↵
              │ b 0021: +               ->  Index Scan using _hyper_X_X_chunk_metrics_space_device_id_time_idx on _hyper_X_X_chunk m2_3         ↵
              │ b 0022: +                     Index Cond: (device_id = 2)                                                                       ↵
              │ c 0023:           ->  Materialize                                                                                               ↵
              │ c 0024: -               ->  Custom Scan (ChunkAppend) on metrics_space m2                                                       ↵
              │ p 0025: -                     Order: m2."time"                                                                                  ↵
              │ p 0026: -                     ->  Index Scan using _hyper_X_X_chunk_metrics_space_device_id_time_idx on _hyper_X_X_chunk m2_1   ↵
              │ b 0027: -                           Index Cond: (device_id = 2)                                                                 ↵
              │ b 0028: -                     ->  Index Scan using _hyper_X_X_chunk_metrics_space_device_id_time_idx on _hyper_X_X_chunk m2_2   ↵
              │ b 0029: -                           Index Cond: (device_id = 2)                                                                 ↵
              │ b 0030: -                     ->  Index Scan using _hyper_X_X_chunk_metrics_space_device_id_time_idx on _hyper_X_X_chunk m2_3   ↵
              │ b 0031: -                           Index Cond: (device_id = 2)                                                                 ↵
              │ c 0032: +               ->  Custom Scan (ChunkAppend) on metrics m1                                                             ↵
              │ p 0033: +                     Order: m1."time"                                                                                  ↵
              │ p 0034: +                     ->  Index Scan Backward using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk m1_1↵
              │ b 0035: +                           Index Cond: (device_id = 1)                                                                 ↵
              │ b 0036: +                     ->  Index Scan Backward using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk m1_2↵
              │ b 0037: +                           Index Cond: (device_id = 1)                                                                 ↵
              │ b 0038: +                     ->  Index Scan Backward using _hyper_X_X_chunk_metrics_device_id_time_idx on _hyper_X_X_chunk m1_3↵
              │ b 0039: +                           Index Cond: (device_id = 1)                                                                 ↵
              │ c 0040:  (20 rows)                                                                                                              ↵
              │ p 0041:                                                                                                                         ↵
              │ p 0042:  -- test OUTER JOIN

To find slow queries:

log_statement = all
log_duration = true

awk -v OFS='\t' 'match($0, /statement: (.+)$/, a) {statement = a[1]} match($0, /^\s+(.*)$/, a) { statement = statement " " a[1] } match($0, /duration: ([0-9.]+)/, a) {print a[1], statement}' ./build-ts/tsl/test/shared/log/postmaster.log | sort -n -k1 -r | head -100

Parts:

Add ANALYZE after compression of `metrics_compressed` in shared test
setup.
Result (actual rows=7196 loops=1)
-> Sort (actual rows=7196 loops=1)
Sort Key: t."time", t.device_id
Sort Method: quicksort
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a regression, why does it no longer use index scan?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple other places look suspicious as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't like these plans as well, and the only thing I did is added ANALYZE. Maybe the table must be made bigger... It seems that the compressed table is very small in some queries (e.g. about 20 rows), so it starts to prefer seq scan.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scan below decompress_chunk shouldnt be affected statistics changes as those are not picked based on cost

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the create_compressed_scan_path, it does make cost-based decisions on seq scan vs index scan (it adds them using the normal add_path), so I guess this might be the reason for what we're seeing here.

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b63fbad) 79.74% compared to head (0501724) 79.37%.

❗ Current head 0501724 differs from pull request most recent head c27f73d. Consider uploading reports for the commit c27f73d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6550      +/-   ##
==========================================
- Coverage   79.74%   79.37%   -0.37%     
==========================================
  Files         189      188       -1     
  Lines       36894    36462     -432     
  Branches     9343     9217     -126     
==========================================
- Hits        29421    28942     -479     
- Misses       3123     3165      +42     
- Partials     4350     4355       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

akuzm added a commit that referenced this pull request Mar 6, 2024
This PR renames some things in preparation to cost changes from
#6550

Also simplifies path creation for partial chunks, improving some plans
(now index scans are used instead of sort).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants