-
Notifications
You must be signed in to change notification settings - Fork 281
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
PG11 NATIVE not create new table when maintenance #237
Comments
Did i miss something config to auto create new partition tables? |
Hello @Roytan,
Are your data not inserted at all, or inserted into the wrong partition, or
else?
You have configured your maintenance operation to run in a `jobmon`
context, all the configuration related is set?
What is the value for premake for your partitioning configuration?
I never used native partitioning in production..
Regards,
Thomas
Le mar. 6 nov. 2018 à 07:52, roytan883 <notifications@github.com> a écrit :
… Did i miss something config to auto create new partition tables?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#237 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANrwfH1qQTL9ZmCCvMIOGx0MDqn9lVgiks5usTG7gaJpZM4YP2Bu>
.
|
@thomasboussekey Already provide all information how to reproduce this bug. Above SQL command you can just copy and run to see the result. |
By default, for time-based partitioning, if no new data is being inserted, no new partitions will be created. If you want new partitions to always be created despite there being no new data, set the I'll see if I can recreate that error you're getting. |
It might make sense to make infinite_time_partitions the default for native partitioning because the partitions need to exist before data can be inserted. |
That is the purpose of the premake value. That should be set high enough to account for the time period that your data is being inserted. And with PG11, the default partition is always created by pg_partman for you to handle when the child table doesn't exist. If that is an important feature for you in native, I highly recommend upgrading to 11. I have this set as the default for time because it's the only option for serial partitioning and I want the default consistent between both. |
@keithf4 Before use Now i test |
If your child table names are as they were above, that would make sense since that time period has no child table. But in normal operations, you should not be inserting data that does not have a specific child table. The default is there to catch mistakes without losing data, but if you continue to allow a lot of data to go to the default, you're defeating the entire purpose of partitioning and will see a degradation in performance over time. It's also not quite as easy to move data out of that default with native since you cannot create any child tables that have data that exists in the default. You have to move the data out of the default, create the table, then insert it back in. So, again, please set your premake high enough to account for your normal data operations. |
@keithf4 For 7 minutes error, I'm sure i did not drop any table manually. I may restart the PG11 at minutes 6. |
@keithf4 This just a demo for me to test partman. I'm plan to use time partition with |
I would recommend leaving it at the default of 4 |
I'm worried about premake:4 will lead some query waste performance to query in future tables. Like use |
4 is not enough to make any noticeable difference, especially when the tables are empty and on PG11 where true partition pruning was introduced. |
I just found that by explain the query, it said will check 5 partition table, scare me. |
It's enabled by default. |
@keithf4 BTW, |
Please see my previous response above as to why this is the default. Additionally, if you have normal data insertion happening, you will never run into the issue of the new table not existing. If you have no data being inserted, why should it continue creating empty, unused tables indefinitely? If you have huge gaps in data insertion periods, then at that point, the better question to ask is why is your partition interval so small that it's causing gaps? The default encourages proper usage of partitioning. |
So I believe this is the same issue being reported here: #227 The user there also only encountered this while testing and not really using pg_partman in normal operating situations. So I am working on a fix for this, but it's not something you should run into as long as new data is being inserted and new partitions are being created as old ones are being dropped. It basically only happens when you're down to a single partition existing. |
This issue as been fixed as of v4.2.0. |
When type is native, seems premake only work at first creation, after that the run_maintenance() only drop retention table but not create new table.
Here is my commands:
each time
call run_maintenance_proc();
only remove those retention tablepush_msg_p2018_11_06_xxxx
. But no new table created.Eg: i created at
2018_11_06_14:30
, aftercall run_maintenance_proc();
i got those initial tablesBut after 2 minutes, at
2018_11_06_14:32
,call run_maintenance_proc();
again. only those tables left:After 4 minutes, at
2018_11_06_14:34
,call run_maintenance_proc();
again. only one table left:No new table created at any time !!!
After 7 minutes,
call run_maintenance_proc()
got those error:Which was strange, I did not call any other commands, but the function says table not exist. I checked the database, the test.push_msg_p2018_11_06_1431 was exist.
The text was updated successfully, but these errors were encountered: