Re: Recursive merging of overlapping arrays in a column - Mailing list pgsql-sql

From Rob Sargent
Subject Re: Recursive merging of overlapping arrays in a column
Date
Msg-id 55FEBBE0.8090902@gmail.com
Whole thread Raw
In response to Recursive merging of overlapping arrays in a column  (dave <audiotecture@web.de>)
Responses Re: Recursive merging of overlapping arrays in a column
List pgsql-sql
<div class="moz-cite-prefix">On 09/20/2015 05:12 AM, dave wrote:<br /></div><blockquote
cite="mid:1442747556700-5866560.post@n5.nabble.com"type="cite"><pre wrap="">Hey mailing list,
 

i have the following Table:



I want to merge the arrays which have overlapping elements, so that I get
the result which doesn't contain overlapping arrays anymore:


I am not an expert in SQL and it took me a long time to come up with this
solution:


Which gives me the result:


Result number 3 is contained in number one and shouldn't be in the output
anymore, because I only want non overlapping arrays in the result.

Another problem I encountered is that the performance of this query seems to
be very bad. I tried running it on a larger table (~400000 arrays) and it is
still running after ~10h.

I would appreciate any input on this problems, so it would be nice if anyone
could give me a hint how to get only the merged arrays without overlaps in
the resultset and maybe how to build a more elegant and efficient query.


Thanks in advance,

Dave



--
View this message in context: <a class="moz-txt-link-freetext"
href="http://postgresql.nabble.com/Recursive-merging-of-overlapping-arrays-in-a-column-tp5866560.html">http://postgresql.nabble.com/Recursive-merging-of-overlapping-arrays-in-a-column-tp5866560.html</a>
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


</pre></blockquote><font face="Courier New, Courier, monospace">I don't see your table def, sql nor result output.
Suggestyou re-post with all those as plain text</font><br /> 

pgsql-sql by date:

Previous
From: dave
Date:
Subject: Recursive merging of overlapping arrays in a column
Next
From: dave
Date:
Subject: Re: Recursive merging of overlapping arrays in a column