Why is Solr so much faster than Postgres?

前端 未结 5 1794
故里飘歌
故里飘歌 2021-01-29 18:27

I recently switched from Postgres to Solr and saw a ~50x speed up in our queries. The queries we run involve multiple ranges, and our data is vehicle listings. For example: \"Fi

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-29 19:01

    Solr is designed primarily for searching data, not for storage. This enables it to discard much of the functionality required from an RDMS. So it (or rather lucene) concentrates on purely indexing data.

    As you've no doubt discovered, Solr enables the ability to both search and retrieve data from it's index. It's the latter (optional) capability that leads to the natural question... "Can I use Solr as a database?"

    The answer is a qualified yes, and I refer you to the following:

    • https://stackoverflow.com/questions/5814050/solr-or-database
    • Using Solr search index as a database - is this "wrong"?
    • For the guardian solr is the new database

    My personal opinion is that Solr is best thought of as a searchable cache between my application and the data mastered in my database. That way I get the best of both worlds.

提交回复
热议问题