On 30-Aug-07, at 3:18 PM, Chris Hostetter wrote:
2. Someone asked me if SOLR utilizes anything like a "stored
procedure" to make queries faster. Does SOLR support anything
such as this?
it's kind of an apples vs orange-juice comparison, ut typcailly
when people talk about DB stored procedures being faster then raw
SQL they are refering tohte fact that the SQL in the stored proc is
compiled only once, and a query plan is produced which is then
reused each time the proc is called with various inputs.
in that regard no, Solr does not have any equivilent functinality.
the query parser that "compiles" string input into Query objects to
execute does not save existing Query structures for reuse with
different input values. the Query=DocSet mappings from previous
queries are cached and reused however ... so two people searching
for hte exact same thing without any index modifications between
them will result in the second person getting very fast
performance ... i don't know of any DB that has anything like
that. Solr's ability to "autowarm" recent queies when doing a
commit is also something i've never heard of any type of DB doing.
Modern SQL DBs have (typically small) query caches that function
similarly to Solr's query/document cache, and row-level caches that
function similarly to the OS disk cache in Solr. Though I don't know
if there is anything quite like filter caches in most DBs.
Another reason why people use stored procs is to prevent multiple
round-trips in a multi-stage query operation. This is exactly what
complex RequestHandlers do (and the equivalent to a custom stored
proc would be writing your own handler).
-Mike