Subject Re: [firebird-support] has the limit of 255 contexts been increased yet?
Author Sam Watkins
On 7/12/2010 5:59 AM, Sam Watkins wrote:
> I am working on a complex firebird database at work. When I try to alter the
> schema e.g. adding a join to a certain view, I later get this error:
>
> "Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255"

On Mon, Jul 12, 2010 at 08:21:57AM -0400, Doug Chamberlin wrote:
> Firebird tracks revisions to database schema and can only retain some
> 255 changes to any given table/view definition. If you backup and
> restore the database the counter will reset to 0 so another 255 changes
> can then be handled.

Okay, this is a different error. I see after doing some testing that there is
indeed as you say a "too many versions" error at the 255 mark. The error I am
getting is a different one.

This "Too many Contexts" error is not related to a schema revision count, it
occurs for example if I use an "iff" conditional in a certain view, and not if
I don't. The number of schema alterations is the same in each case. I believe
"contexts" refers to evaluation contexts, or scopes, used in a query. We're
getting this error because our database has a complex structure with lots of
tables, views and joins.

A single query in our database may be using a total of more than 255 tables,
views, joins, conditionals etc all together. An "iff" expression definitely
counts as a "context" and can push us over the limit.

I'm disappointed to see that Firebird has ANOTHER 255 limit (the "too many
versions" limit you mentioned) in addition to the one that is bothering me (the "Too many
Contexts" limit).

Hopefully we will be able to hack the source to increase these limits
to 2^32 - 1 or something like that (using an int instead of an unsigned char).

I mean really, this sort of 1-byte limit is ridiculous in 2010. Our little
test database is over 30 Mb in size, who would care about allocating an extra 3
bytes per object for a bigger version number, totalling an extra 4KB for our
database? Who would care about an extra 3 bytes per context or whatever to
support more than 255 contexts, which might use an extra 4KB of RAM per active
query. I don't care if its uses an extra 4MB per query.

It's like something from the dark ages of DOS where 640Kb was more than enough
for everyone. 255 contexts and 255 versions is more than enough for anyone!

Regarding the versioning limit, this is not likely to bite us with the way we
maintain out databases, but it might be a major annoyance for someone with a
large database to have to back it up and restore it, just so firebird can save
3 bytes per database object or whatever.

I'm not dissing Firebird, I actually like it, but I think these limits at the
255th whatever are a nonsense anachronism.

regards,

Sam Watkins



> If you are actively designing/developing the schema the "problem" should
> go away once the schema stabilizes and frequency of changes goes down.
> If you are in a production environment then you will want to re-think
> your strategy of making frequent schema changes.
>
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>