Hi,
The index settings for a database can make a huge difference to query performance. I have been playing with a database where the time for a query using distinct-values went from 4secs to 4ms by increasing the MAXCATS value. Currently it is rather fiddly to change these values, particularly to this programmatically. with different values per database.
I would find it useful there was an easier way to do this. A quick suggestion as to how this might be done:
db:optimize could be extended to taker a third argument that matched the format of in indexes portion of the db:info command
<indexes>
<uptodate>true</uptodate>
<textindex>ON</textindex>
<attributeindex>ON</attributeindex>
<fulltextindex>OFF</fulltextindex>
<updindex>OFF</updindex>
<maxcats>100</maxcats>
<maxlen>96</maxlen>
</indexes>
e.g
db:optimize("mydb",fn:true(),$indexopts)
This would rebuild "mydb" using the settings specified in $indexopts. The extra argument could also be added to db:create.
/Andy