Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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


pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group