> So - are you saying that if you have a table, and you create an index on > that table, you need to perform an ANALYZE in order for PG to use the > index. Otherwise, the index goes unused (or used improperly)?
it is easy enough to demonstrate that creating an index will result in immediate improvements in query times. The internals wizards would have to answer the question as to whether 'create index' also creates the initial stats on that index, though. (If it doesn't, maybe that should be a configuration option.) However, you do need the stats to take best advantage of the index over time and a wide range of queries, so regularly scheduled 'vacuum analyze's are desirable. What I don't know is whether there is a way pass along hints to the optimizer or to write a query to FORCE it to use an index on some part of a query despite what the optimizer decides. -- Mike Nolan ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings