On Wed, 24 Mar 2010 02:03:04 -0400, Tom Hanlon <[email protected]> wrote: > Looking at what cluster does it is even simpler, > > I believe it does something like.. tell the optimizer that the table > has 100 rows, and using an index will return 10 rows. This is > sufficient to force an index use. Rather simple but it does get the > index used.
... in most cases... for certain queries having FORCE INDEX is needed (and a common trick to force the optimiser to do better with NDB). But yeah, without ndb_index_stat_enable, it just returns 10. A while ago Pekka was working on much better index statistics for NDB, including having computed statistics stored in NDB (so each SQL node would get them without each having to generate them) and caching them in the SQL nodes. Since it was stored in NDB you could do predictable things by modifying this by hand :) > So not much help for a clean solution, but in general I recommend a > view at the cluster source for examples as well because what cluster > does to in terms of dealing with the optimizer is quite different than > what the other engines might do. the 10 and 100 have worked pretty well for such a naive implementation :) -- Stewart Smith _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

