Hi,

I am having a small performance problem and wondered whether you guys  
could give a little advice.

Here's the problem:

I have three tables A, B and C. Basically A and C have a m:n  
relationship, B serves as the link.
While knowing a primary key for an entry in A, I would like to get all  
the connected Cs and then have them ordered by some field that I know  
is indexed.

Basically this:

SELECT c.id
FROM A a
INNER JOIN B b ON a.id=b.aID
INNER JOIN C c ON b.cID=c.id
WHERE a.id=<somevalue>
ORDER BY c.someIndexedField

Looking at what EXPLAIN produces, H2 (1.0.79) uses indexes for  
everything but the ordering. As a result, the query is quite slow on  
large tables.

Is there any way I can cause H2 to execute this or a similar query  
more quickly?

Thanks in advance!

-hendrik


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to