
Full-Text Search Performance: Postgres vs. Elasticsearch - izietto
https://rocky.dev/full-text-search
======
snikolaev
Nice article!

1\. There seems to be an inconsistency in the provided scripts as
elasticsearch query refers to fields "valStr" and "keyStr" and they do not
exist. Therefore (at least in my case) the query indeed takes <10ms, but finds
nothing. If I change it to using "val" and "key" it takes 19-20ms as reported
by Elasticsearch:

    
    
      snikolaev@dev:~/rocky.dev$ time curl -sX GET "localhost:9200/search-idx/_search?pretty" -H 'Content-Type: application/json' -d'
      {
      "query": {
        "simple_query_string" : {
          "query": "\"repellat sunt\" -quis",
          "fields": ["val", "key"],
          "default_operator": "and"
        }
      }
      }
      '|jq .took
      19
    
      real 0m0.044s
      user 0m0.012s
      sys 0m0.012s
    

and 40-45ms including the connection etc. overhead.

2\. I've loaded exactly the same data to Manticore Search. It takes ~14ms /
32ms correspondingly for the same query on the same server:

    
    
      snikolaev@dev:~/rocky.dev$ time mysql -P9306 -h0 -e "select * from rocky where match('@(val,key) \"repellat sunt\" -quis'); show meta;"|grep time
      time 0.014
    
      real 0m0.032s
      user 0m0.013s
      sys 0m0.006s
    

so it might make sense to consider it too, especially given the author has
experience with PostgreSQL as Manticore Search has full-fledged SQL support
(unlike Elasticsearch).

