Hi,

Is there a way to force H2 to use an index
> instead of another one (hint?)?
>

Currently, there are not many ways to enforce one index is used. One way is
to set the selectivity manually before running the query:

alter table test alter column id selectivity 4;

However, the selectivity will be re-evaluated from time to time (this can be
disabled by appending ;
ANALYZE_AUTO=0 to the database URL).

Another workaround is to ensure the wrong index can't be used:

ANALYZE SELECT COUNT(1) FROM endf_sections WHERE mat_key=5159
AND -mf=-3 AND (-mt=-4 OR -mt=-14)

Support for hints is quite high on the priority list, I will implement it in
one of the next releases.


> How exactly is selectivity computed? In the H2 console, if we display
> the first 10000 rows of this table, we obtain 139 distinct values
> yielding a selectivity of 1 we presume; Is that correct?
>

Yes.

Regards,
Thomas

-- 
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