Re: Very specialised query

From: Віталій Тимчишин <tivv00(at)gmail(dot)com>
To: Matthew Wakeling <matthew(at)flymine(dot)org>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Very specialised query
Date: 2009-03-31 21:11:52
Message-ID: 331e40660903311411k532df0e3jeeffdb184adba9e6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>
>
> The outer nested join has the VALUES as the main loop, and the complicated
> join as the leaf. So, the complicated overlap-finding join gets run twice.

That's weird. What do you have as statistics target? Planner is incorrect
few orders of magnitude, so increasing it may help.
BTW: One of constraints is redundant l1.start <= l2.start implies l1.start
<= l2.end, so latter can be removed as for me.

>
>
> Oh, there's also the great big sort and unique, but I think I can get rid
> of that.
>

As far as I can see, duplicates will occur if and only if l1.start ==
l2.start && l1.end == l2.end.
That can be easily filtered by adding "where n=1 or l1.start != l2.start or
l1.end != l2.end" to outer select.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2009-03-31 21:35:59 Re: Strange behavior: pgbench and new Linux kernels
Previous Message Matthew Wakeling 2009-03-31 17:08:00 Re: Very specialised query