Subject | Re: [firebird-support] Re: Implement maximum database size |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2007-12-19T22:11:47Z |
Well, Branimir, it is possible to make approximate counts that are much
faster than actually counting the rows. I don't quite remember how (look
for things like 'approximate count' or 'quick count', I think I saw it
on fbtalk that I'm uncertain whether still exists). It will be less
accurate than actually counting all rows, and I'm uncertain how it works
if statistics aren't up-to-date.
Another option is to have a trigger that checks against a maximum limit
for the primary key. As long as that trigger is active, no inserts above
the limit will have any chance to succeed. However, it isn't all to
difficult to simply disable the trigger if the users are somewhat
'Firebird literate'.
HTH,
Set
btrumba wrote:
faster than actually counting the rows. I don't quite remember how (look
for things like 'approximate count' or 'quick count', I think I saw it
on fbtalk that I'm uncertain whether still exists). It will be less
accurate than actually counting all rows, and I'm uncertain how it works
if statistics aren't up-to-date.
Another option is to have a trigger that checks against a maximum limit
for the primary key. As long as that trigger is active, no inserts above
the limit will have any chance to succeed. However, it isn't all to
difficult to simply disable the trigger if the users are somewhat
'Firebird literate'.
HTH,
Set
btrumba wrote:
> Thanks for help.
> I'm now aware that psychical database file size does nothing to do
> with actual amount of user data stored into the database.
>
> Just one more question:
> Any tip on how to implement database limit restriction on user?
>
> Only solution I can think of is to place triggers on all tables, count
> all records in all tables, and then prevent user to insert/modify more
> data then he is allowed. But, this will be slow and not 100% accurate
> because of possible ongoing transactions...
>
>
> Thanks for any advice,
>
> Branimir