You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Drew Kidder <dr...@gmail.com> on 2020/07/13 17:05:34 UTC

Performance difference between query by id and filter query on property

We're switching to using composite routing in our solr cloud collection,
and of course that changes the document id. If I'm setting the document id
myself, what is the performance difference between q=id:123!4567 and
q=*:*&fq=some_field:4567?

Example:

Pre-indexed document:
   - field1: 4567
   - field2: 123
   - field3: some random string

Post-indexed document in solr (using field2 as the shard prefix and field1
as the document id):
    - id: 123!4567
    - field1: 4567
    - field2: 123
    - field3: some random string

What would be the performance difference between "q=id:123!4567" and
"q=*:*&fq=field1:4567"? In the end, they're both returning documents by id.
The main difference I can see is that it would take up a cache entry to do
what is essentially a lookup by id (or the value that I want to be the id,
before composite routing comes into play).

Since Solr doesn't drop the shard prefix from the document id when it
indexes, any way to get around this to use another discreet field as a
pseudo-document id?

--
Drew(id@gmail.com)
http://wyntermute.dyndns.org/blog/

-- I Drive Way Too Fast To Worry About Cholesterol.