Hi, The MySQL syntax sounds good to me. As an alternative, the MS SQL Server syntax, see also https://msdn.microsoft.com/en-us/library/ms190322.aspx and maybe http://blog.sqlauthority.com/2009/02/08/sql-server-introduction-to-force-index-query-hints-index-hint-part2/
A related feature is to fail queries if no index is available. This is what SQLite is doing: https://sqlite.org/lang_indexedby.html . Apache Jackrabbit Oak has a similar feature: https://issues.apache.org/jira/browse/OAK-4888 I'm not sure which feature is more important. Regards, Thomas On Wednesday, January 4, 2017, Sergi Vladykin <[email protected]> wrote: > I'd prefer to just go with MySQL syntax and not reinvent the wheel. > > Sergi > > 2017-01-04 16:14 GMT+03:00 Noel Grandin <[email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>>: > >> I'm ok with that. I think MySQL' s index syntax looks ok to me, although >> I'd prefer an index name instead of a key list. >> On Wed, 04 Jan 2017 at 14:13, Steve McLeod <[email protected] >> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote: >> >>> I'm considering attempting to add index hints to H2. >>> >>> Questions: >>> * Is this a good idea? Or is it better to work on making the query >>> optimizer smarter at choosing the correct index? >>> * Is Oracle's syntax preferable? Or MySQL's syntax? Or is there a better >>> syntax altogether? >>> >>> Oracle: >>> SELECT /*+ INDEX (employees emp_department_ix)*/ >>> employee_id, department_id >>> FROM employees >>> WHERE department_id > 50; >>> >>> MySQL: >>> SELECT * FROM table1 USE INDEX (col1_index,col2_index) >>> WHERE col1=1 AND col2=2 AND col3=3; >>> >>> >>> -- >>> 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] >>> <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> >>> . >>> To post to this group, send email to [email protected] >>> <javascript:_e(%7B%7D,'cvml','[email protected]');>. >>> Visit this group at https://groups.google.com/group/h2-database. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> 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] >> <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> >> . >> To post to this group, send email to [email protected] >> <javascript:_e(%7B%7D,'cvml','[email protected]');>. >> Visit this group at https://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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] > <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > Visit this group at https://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- 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 https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
