Bob Futrelle wrote: If looking for the variants with a single suffixed character is all you'll ever need to do: Do a single pass on the large table, after creating a field, 'trunc' that contains a truncated version of the item, e.g., adding XY423 to trunc for each entry of the form XY423A, or XY423B, etc. This would be a one-time operation.
Hi Bob, unfortunately it is not because the suffix pattern is not always the same. On the other hand, I tried to split the query into select substring (code from '^[A-Z]+[0-9]+') as code into tmp table t select .... where tab2.code = t.code which definitely was a big improvement. I believe that most of the time passing in a pattern like that would work So thank you for that tip Regards Wolfgang -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general