Hi, Isn’t above select query supposed to use index , INDEX1 that we > created ? >
Yes, if the selectivity on the NAME column is low (smaller than 20). See also the documentation. Example: drop table abc; CREATE TABLE ABC (NAME VARCHAR(20) , AGE INTEGER); insert into abc select x/6, x from system_range(1, 100); analyze; CREATE INDEX INDEX2 ON ABC( NAME,AGE); EXPLAIN SELECT DISTINCT NAME FROM ABC; EXPLAIN SELECT NAME FROM ABC group by name; 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.
