ir_translation: Index rows size exceeds btree maximum

Bug #544437 reported by José Pastor
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Undecided
Unassigned

Bug Description

Sorry my English.

I add new product A with

A.name
A.description_en

description_en is text type then no problem with length.

I can save new product without problem when description_en is very long.

Now, I translate this very long field, description_en, to Spanish with A.description_es

When I entry description_es, system inserts src and valeu in ir_translation.

src set to A.description_en
value set to A.description_es

Because src is involved in some btree index, then A.description_en is length limited.

If A.description_es is long enough then system launchs this message:

ERROR: index row size 5364 exceeds btree maximum, 2713

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Seems that currently the index is being created like this:
--
CREATE INDEX ir_translation_lts
  ON ir_translation
  USING btree
  (lang, type, src);
--

I think a workaround would be to use partial indexes that exclude long items (you still will be able to search for that long items, they will just took longer):

--
DROP INDEX ir_translation_lts;
CREATE INDEX ir_translation_lts
  ON ir_translation
  USING btree
  (lang, type, src)
  WHERE LENGTH(src) < 2500;
--

Can you test if that solves your problem?

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

The attached patch solves the problem by using two indexes:

- One of type btree for 'lang', 'type' and 'name' fields
- Another one of type hash for 'src' field

The reason is that hash indexes do not support multiple columns. Also note that AFAIK current indexes have no sense given that PostgreSQL can use an index composed of (lang, type, name, src) to search by (lang, type, name) only. So there was no reason for having both of them (indeed it's probably worse performance wise).

As stated by Borja, another option would be to use a partial index, but I think it complicates things a little bit and would affect performance negatively in databases with lots of large strings (ie. users with lots of large descriptions in products, for example).

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello all,

   It has been fixed by revision 2127 <email address hidden>
@Albert : Thanks a lot for pointing towards such issue and helping to resolving it.

Thanks.

Changed in openobject-server:
milestone: none → 5.0.15
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.