|
|
|
|
|
by nh2
2826 days ago
|
|
I, too, would be very interested to find a Postgres-based replacement for Elasticsearch. Specifically replacing ELK by Postgres-Kibana. Requirements for that: * Events are (timestamp, {arbitrarily nested JSON object})
* Filtering by timestamp must be fast
* Full-text search on the object is required
* Exact constraints on all object keys must be fast
* It should be possible to define indices on the object's fields so that WHERE clauses are fast
* Counting the number of results should be fast, or at least have fast reasonably accurate estimates
* Support typical Kibana searches and filters
I have tried so far to implement Kibana's access patterns on Postgres, and got quite far, but never got past the problem of https://wiki.postgresql.org/wiki/Slow_Counting, which essentially means postgres must scan the whole table if you write a WHERE clause, even when using indices, because it has to double-check whether the returned rows weren't actually deleted. |
|
- BTREE(time DESC)
- BTREE(time DESC, object)
- GIN(object)
- some kind of full text index
I don't know why the slow counting problem would be a problem with WHERE clauses since indexes are highly optimized to work with MVCC (e.g. hint bits etc). The wiki article itself says this isn't much of a problem when using indexes. But maybe you can elaborate?