Re: Slow query with 3 table joins

From: Alessandro Ferrucci <alessandroferrucci(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Slow query with 3 table joins
Date: 2017-04-26 11:04:55
Message-ID: CAMgh6pJ_i+w-xP+FJiNbz6pSKJDbHnaYPyh9bnb5xUYr4PBH6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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 <eskil(at)kth(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

--
Signed,
Alessandro Ferrucci

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alessandro Ferrucci 2017-04-26 11:35:35 Re: Slow query with 3 table joins
Previous Message Johan Fredriksson 2017-04-26 06:24:27 Re: Slow query with 3 table joins