Closed
Description
step
1. create a range partition table with 5 min interval. Then fill data into the table.
CREATE TABLE journal (
id SERIAL,
dt TIMESTAMP NOT NULL,
level INTEGER,
msg TEXT);
SELECT create_range_partitions('journal', 'dt', '2017-01-01'::timestamp, '5 min'::interval, 1000);
INSERT INTO journal (dt, level, msg)
SELECT g, random() * 6, md5(g::text)
FROM generate_series('2017-01-01'::timestamp, '2017-01-5'::timestamp, '2 second') as g;
2. drop some partitions for a day's begining
[postgres@cnsz033302:5433/k1 M] [08-28.19:22:37]=# select drop_range_partition('journal_577',true);
drop_range_partition
----------------------
journal_577
(1 row)
Time: 23.144 ms
[postgres@cnsz033302:5433/k1 M] [08-28.19:22:50]=# select drop_range_partition('journal_578',true);
drop_range_partition
----------------------
journal_578
(1 row)
Time: 24.799 ms
[postgres@cnsz033302:5433/k1 M] [08-28.19:22:59]=# select drop_range_partition('journal_579',true);
drop_range_partition
----------------------
journal_579
(1 row)
Time: 18.375 ms
3. wrong result when filter condition contains the droped time range
[postgres@cnsz033302:5433/k1 M] [08-28.19:23:06]=# select count(*) from journal where dt > '2017-01-03'::timestamp;
count
-------
0
(1 row)
Time: 21.987 ms
[postgres@cnsz033302:5433/k1 M] [08-28.19:31:59]=# select count(*) from journal where dt < '2017-01-03 00:05:00'::timestamp;
count
-------
0
(1 row)
Time: 0.535 ms
4. correct result
[postgres@cnsz033302:5433/k1 M] [08-28.19:23:47]=# select count(*) from journal where dt > '2017-01-04'::timestamp;
count
-------
43200
(1 row)
Time: 23.115 ms
[postgres@cnsz033302:5433/k1 M] [08-28.19:23:53]=# select count(*) from journal where dt < '2017-01-03'::timestamp;
count
-------
86400
(1 row)
Time: 47.868 ms
[postgres@cnsz033302:5433/k1 M] [08-28.19:31:43]=# select count(*) from journal where dt < '2017-01-03 05:00'::timestamp;
count
-------
94950
(1 row)
Time: 35.960 ms
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
killua001 commentedon Aug 28, 2017
partition's min & max value:
journal | journal_576 | 2 | dt | 2017-01-02 23:55:00 | 2017-01-03 00:00:00
journal | journal_577 | 2 | dt | 2017-01-03 00:00:00 | 2017-01-03 00:05:00
journal | journal_578 | 2 | dt | 2017-01-03 00:05:00 | 2017-01-03 00:10:00
journal | journal_579 | 2 | dt | 2017-01-03 00:10:00 | 2017-01-03 00:15:00
journal | journal_580 | 2 | dt | 2017-01-03 00:15:00 | 2017-01-03 00:20:00
journal | journal_581 | 2 | dt | 2017-01-03 00:20:00 | 2017-01-03 00:25:00
[-]Wrong result after drop partition[/-][+]Wrong result after drop partition (gap)[/+]funbringer commentedon Aug 28, 2017
Hi @killua001,
thank you for the bug report! We're working on a solution.
bsearch: fix non-eq WHERE conditions pointing to gaps (issue #117)
funbringer commentedon Aug 29, 2017
Could you try
master_hotfix_issue_117
branch? It looks like everything works fine now:killua001 commentedon Aug 30, 2017
@funbringer ,
Thank you。
And when the1.4.4 release?
funbringer commentedon Aug 30, 2017
This week, I suppose.
funbringer commentedon Aug 31, 2017
Released 1.4.4.
killua001 commentedon Sep 1, 2017
Great work!
Thank you.