Re: [Q] How do I force usage of index
Posted in 1997
fjoy@fdgroup.co.uk wrote: > > I have an OWS 7.12 application comprising 60,000 records (on a Sun > Enterprise) on which even simple indexed join queries run very slowly > (i.e., 'where tablea.id = tableb.id' will take 30 seconds). > > Using SET EXPLAIN ON it seems that none of the queries are using the > indexes (all sequential scans). I have data files, indexes and blobs > separated into different dbspaces and update statistics is run > regularly. > > Is there any way I can force usage of the indexes to see if it makes any > difference (presuming that the the query optimizer has decided not to > use them for some reason) ? > One way of doing this is through the OPTCOMPIND configuration variable. Check the value of it in ONCONFIG.If is set to 2 set it to 0 and check with set explain on if it uses the indexes. Basically with the 0 value the optimizer behaves as in previous versions of Online choosing index scans over table scans regardless of the cost. With the 2 value the optimizer bases his decision on cost to use the appropriate path HTH Tolis Varnas -- V+K Relational Solutions mailto:tvarnas@compulink.gr Deligiorgi 26 mailto:tvarnas@orbit.de 546 42 Thessaloniki Voice: +30-31-820270 Greece Fax: +30-31-865463