Hello Noel,

Thanks for your prompt response.

Op donderdag 4 juni 2015 10:22:01 UTC+2 schreef Noel Grandin:

Change your index so that it is indexing on (START, TYPE) 
>
> That way, things that just need an index on START can use it as well. 
>

In this example it works fine, however I also have query's (with filters on 
TYPE)  witch are not related to START.

regards,

Rinse
 

>
>
> On 2015-06-04 10:16 AM, Rinse Lemstra wrote: 
> > The query below takes about 5 sconds to run 
> > 
> > select uren.MEDEW_ID as MEDEW_ID,  uren.START as UREN_WEEK, 
> sum(uren.DUUR) as DUUR 
> > from uren as uren 
> > where uren.START >= '2015-05-25' 
> > and uren.START < '2015-06-01' 
> > and *uren.type = 0* 
> > group by uren.MEDEW_ID, UREN_WEEK 
> > 
> > When I remove the *uren.type = 0* where clause, the query runs in a few 
> miliseconds. 
> > 
> > When I EXPLAIN the query I see it uses the index on the field TYPE, when 
> I remove the *uren.type = 0*, the query uses 
> > the index on START. Also, when I remove the index on the field TYPE the 
> query runs fast. 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to