Using bigint as Ids for view (table_query)? and for regular models?

We use a bigint on a View (table_query) as Id.

In postgres
Max integer 2147483647
Max bigint 9223372036854775807

We use Ids that are bigger than 2147 million for views (group by). We compose more than one Id by shifting (mulliply) by max number or rows expected and add ids. This calculated Ids are bigger than Max integer (they are bigint). Using this calculated Ids is the only way that we found to make views fast in Tryton. The Id is calculated and maintained in the table that is queried in the view group by. The calculated Id is indexed.

Everything seems to works fine with bigint.
Should we be worried of an unforeseen problem for using bigint instead of integer for the Id?
Could we have done something better/different with the Id of the view?
Can we change an Id to bigint in a table “of a Model” and everything will keep working fine?

1 Like

This is what we expect.

Be careful about foreign keys. Tryton create foreign keys as INT by default see Make BigInt configurable (#9825) · Issues · Tryton / Tryton · GitLab

The UnionMixin may help you to compute smaller ids. But it should also be defined with BIGINT: Cast UnionMixin id (#9824) · Issues · Tryton / Tryton · GitLab

It should except for the pointed caveat.

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.