Proposal for disk quota feature

2018-08-30 Thread Hubert Zhang
Hi all, We want to introduce disk quota feature into Postgres. *Why disk quota* *In a multi-tenant environment, there is a requirement to limit the disk quota that database/schema/table can be written or a user can consume for different organizations.* *Meanwhile, other databases such as Oracle, T

Re: Proposal for disk quota feature

2018-08-30 Thread Chapman Flack
On 08/30/2018 09:57 AM, Hubert Zhang wrote: > 2 Keep one worker process for each database. But using a parent/global > quota worker process to manage the lifecycle of database level worker > processes. It could handle the newly created database(avoid restart > database) and save resource when a da

Re: Proposal for disk quota feature

2018-08-30 Thread Pavel Stehule
2018-08-30 16:22 GMT+02:00 Chapman Flack : > On 08/30/2018 09:57 AM, Hubert Zhang wrote: > > > 2 Keep one worker process for each database. But using a parent/global > > quota worker process to manage the lifecycle of database level worker > > processes. It could handle the newly created database(

Re: Proposal for disk quota feature

2018-09-02 Thread Hubert Zhang
Thanks Chapman. @Pavel, could you please explain more about your second suggestion "implement some quotas on storage level?" We will not keep the long-lived processes attach to all databases(just like you mentioned servers with thousands of databases) And you are right, we could share ideas with a

Re: Proposal for disk quota feature

2018-09-02 Thread Pavel Stehule
Hi 2018-09-02 14:18 GMT+02:00 Hubert Zhang : > Thanks Chapman. > @Pavel, could you please explain more about your second suggestion "implement > some quotas on storage level?" > See attached patch - it is very simple - and good enough for our purposes. Regards Pavel > We will not keep the

Re: Proposal for disk quota feature

2018-09-02 Thread Hubert Zhang
Thanks Pavel. Your patch did enforcement on storage level(md.c or we could also use smgr_extend). It's straight forward. But I prefer to implement disk_quota as a feature with following objectives: 1 set/alter disk quota setting on different database objects, e.g. user, database, schema etc. not on

Re: Proposal for disk quota feature

2018-09-02 Thread Pavel Stehule
2018-09-03 3:49 GMT+02:00 Hubert Zhang : > Thanks Pavel. > Your patch did enforcement on storage level(md.c or we could also use > smgr_extend). It's straight forward. > But I prefer to implement disk_quota as a feature with following > objectives: > 1 set/alter disk quota setting on different dat

Re: Proposal for disk quota feature

2018-09-21 Thread Hubert Zhang
*Hi all,We redesign disk quota feature based on the comments from Pavel Stehule and Chapman Flack. Here are the new design.OverviewBasically, disk quota feature is used to support multi-tenancy environment, different level of database objects could be set a quota limit to avoid over use of disk sp

Re: Proposal for disk quota feature

2018-09-21 Thread Pavel Stehule
pá 21. 9. 2018 v 13:32 odesílatel Hubert Zhang napsal: > > > > > *Hi all,We redesign disk quota feature based on the comments from Pavel > Stehule and Chapman Flack. Here are the new design.OverviewBasically, disk > quota feature is used to support multi-tenancy environment, different level > of

Re: Proposal for disk quota feature

2018-09-21 Thread Hubert Zhang
> > just fast reaction - why QUOTA object? > Isn't ALTER SET enough? > Some like > ALTER TABLE a1 SET quote = 1MB; > ALTER USER ... > ALTER SCHEMA .. > New DDL commans looks like too hard hammer . It's an option. Prefer to consider quota setting store together: CREATE DISK QUOTA way is more natur

Re: Proposal for disk quota feature

2018-09-21 Thread Jeremy Finzel
On Fri, Sep 21, 2018 at 9:21 AM Hubert Zhang wrote: > just fast reaction - why QUOTA object? >> Isn't ALTER SET enough? >> Some like >> ALTER TABLE a1 SET quote = 1MB; >> ALTER USER ... >> ALTER SCHEMA .. >> New DDL commans looks like too hard hammer . > > > It's an option. Prefer to consider quo

Re: Proposal for disk quota feature

2018-09-21 Thread Pavel Stehule
pá 21. 9. 2018 v 16:21 odesílatel Hubert Zhang napsal: > just fast reaction - why QUOTA object? >> Isn't ALTER SET enough? >> Some like >> ALTER TABLE a1 SET quote = 1MB; >> ALTER USER ... >> ALTER SCHEMA .. >> New DDL commans looks like too hard hammer . > > > It's an option. Prefer to consider

Re: Proposal for disk quota feature

2018-09-21 Thread Hubert Zhang
> > But it looks like redundant to current GUC configuration and limits what do you mean by current GUC configuration? Is that the general block number limit in your patch? If yes, the difference between GUC and pg_diskquota catalog is that pg_diskquota will store different quota limit for the dif

Re: Proposal for disk quota feature

2018-09-22 Thread Pavel Stehule
so 22. 9. 2018 v 8:48 odesílatel Hubert Zhang napsal: > But it looks like redundant to current GUC configuration and limits > > what do you mean by current GUC configuration? Is that the general block > number limit in your patch? If yes, the difference between GUC and > pg_diskquota catalog is t

Re: Proposal for disk quota feature

2018-09-24 Thread Hubert Zhang
> > The quotas or object limits, resource limits are pretty useful and > necessary, but I don't see these like new type of objects, it is much more > some property of current objects. Because we have one syntax for this > purpose I prefer it. Because is not good to have two syntaxes for similar > p