Re: Improving self join time

2014-03-20 Thread Stephen Sprague
so that's your final assessment, eh? :) What is your comment about the outer query _joining on value_ to get the key? On Thu, Mar 20, 2014 at 12:26 PM, Jeff Storey wrote: > I don't think so since the inner result doesn't have the key field in it. > It ends up being > > select key from (query

Re: Improving self join time

2014-03-20 Thread Jeff Storey
I don't think so since the inner result doesn't have the key field in it. It ends up being select key from (query result that doesn't contain the key field) ... On Thu, Mar 20, 2014 at 1:28 PM, Stephen Sprague wrote: > I agree with your assessment of the inner query. why stop there though? > D

Re: Improving self join time

2014-03-20 Thread Stephen Sprague
I agree with your assessment of the inner query. why stop there though? Doesn't the outer query fetch the ids of the tags that the inner query identified? On Thu, Mar 20, 2014 at 9:54 AM, Jeff Storey wrote: > I don't think this quite fits here..I think the inner query will give me a > list of

Re: Improving self join time

2014-03-20 Thread Jeff Storey
I don't think this quite fits here..I think the inner query will give me a list of duplicate elements and their counts, but it loses the information as to what id had these elements. I'm trying to find which pairs of ids have any duplicate tags. On Thu, Mar 20, 2014 at 11:57 AM, Stephen Sprague

Re: Improving self join time

2014-03-20 Thread Stephen Sprague
hmm. would this not fall under the general problem of identifying duplicates? Would something like this meet your needs? (untested) select -- outer query finds the ids for the duplicates key from ( -- inner query lists duplicate values select count(*) as cnt, value

Improving self join time

2014-03-20 Thread Jeff Storey
I have a table with 10 million rows and 2 columns - id (int) and element (string). I am trying to do a self join that finds any ids where the element values are the same, and my query looks like: select e1.id, e1.tag, e2.id as id2, e2.tag as tag2 from elements e1 JOIN elements e2 on e1.element = e