Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: table join problem
Perica Milosevic wrote:
> Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1073668017.378941_at_yasure>... >
> > > > No this is not a school work, real problem is much more complicated. I > have 3 connected tables (Ticket->TicketRowOdds->MatchOdds) and each > table has more than 100000 rows. I need the fastest possible solution, > everything I've already tried is very slow. My fastest solution is: > > SELECT 'everything i need' > FROM Ticket t, TicketRowOdds tro, MatchOdds mo > WHERE (tro.ticketId = t.id) AND > (mo.matchId = tro.matchid) AND > (exists (select * > from TicketRowOdds tro2, MatchOdd mo2 > where (tro2.ticketId = t.id) AND > (mo2.matchid = tro2.MATCHID) AND > (mo2.something > t.something))) > > Because of "(mo2.something > t.something)" I need to perform this > join. > I use Oracle 8.1 > > Thanks in advance, > Perica Milosevic
Given the number of records involved indexes will definitely help? So the first questions, before you start changing your SQL are "Do they exist?" and "Are they being used?"
You should check in user_ind_columns to make sure indexes exist for the columns in your WHERE clauses. Then ... to make sure they are being used run EXPLAIN PLAN on your query.
When you are done ... post the EXPLAIN PLAN.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Mon Jan 12 2004 - 09:35:47 CST
![]() |
![]() |