Hi Eskil - The I believe the id-field you're referring to is the UNIT.UNIT_ID, I could change this to a varchar, however that column is not used in the query in question, so that wouldn't have any effect on the query's performance.
Just for curiosity - I have changed the ANSWER.ANS datatype to a varchar(250), but that did not affect the performance of the query. On Wed, Apr 26, 2017 at 2:24 AM, Johan Fredriksson <es...@kth.se> wrote: > tis 2017-04-25 klockan 23:19 -0400 skrev Alessandro Ferrucci: > > After about 40 inutes the slow query finally finished and the result > > of the EXPLAIN plan can be found here: > > > > > > https://explain.depesz.com/s/BX22 > > > > > > Thanks, > > Alessandro Ferrucci > > I'm not so familiar with the index implementetion in Postgres, but I > don't think it is very efficient to index a text-field. It also loooks a > bit strange that a id-field has the datatype "text" rather than integer > or varchar. > > / Eskil > > > > > > -- > Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance > -- Signed, Alessandro Ferrucci