Re: [SQL] optimize self-join query

2011-10-29 Thread Ty Busby
Thanks to everyone for all the thoughtful responses. They have been incredibly helpful. Ended up optimizing per Lee, and creating buckets per Tom. Thanks again. On Oct 25, 2011, at 2:37 PM, Ty Busby wrote: I have a table that stores a very large starting number called epc_start_numeric and a

Re: [SQL] optimize self-join query

2011-10-28 Thread Harald Fuchs
In article , Ty Busby writes: > I have a table that stores a very large starting number called > epc_start_numeric and a quantity. I've apparently built the most > inefficient query possible for doing the job I need: find out if any > records overlap. Imagine the epc_start_numeric + quantity >

Re: [SQL] optimize self-join query

2011-10-27 Thread Lee Hachadoorian
On Tue, Oct 25, 2011 at 2:37 PM, Ty Busby wrote: > I have a table that stores a very large starting number called > epc_start_numeric and a quantity. I've apparently built the most > inefficient query possible for doing the job I need: find out if any records > overlap. Imagine the epc_start_nu

Re: [SQL] optimize self-join query

2011-10-27 Thread Tom Lane
Ty Busby writes: > I have a table that stores a very large starting number called > epc_start_numeric and a quantity. I've apparently built the most inefficient > query possible for doing the job I need: find out if any records overlap. > Imagine the epc_start_numeric + quantity representing

[SQL] optimize self-join query

2011-10-27 Thread Ty Busby
I have a table that stores a very large starting number called epc_start_numeric and a quantity. I've apparently built the most inefficient query possible for doing the job I need: find out if any records overlap. Imagine the epc_start_numeric + quantity representing a block of numbers. I ne