269 points · by coatue · 3y ago · 77 comments
hydra is an open source, column-oriented postgres. you can set up remarkably fast aggregates on your project in minutes to query billions of rows instantly.
postgres is great, but aggregates can take minutes to hours to return results on large data sets. long-running analytical queries hog database resources and degrade performance. use hydra to run much faster analytics on postgres without making code changes. data is automatically loaded into columnar format and compressed. connect to hydra with your preferred postgres client (psql, dbeaver, etc).
following 4 months of development on hydra v0.3.0-alpha, our team is proud to share our first major version release. hydra 1.0 is under active development, but ready for use and feedback. we’re aiming to release 1.0 into general availability (ga) soon.
for testing, try the hydra free tier to create a column-oriented postgres instance on the cloud. https://dashboard.hydra.so/signup
Where can I read about what the differences / trade offs are? I don’t see anything in the docs.
Can we expect support for gist, gin, spgist, and brin indexes sometime in the near future?
Based on the source code, it appears that they are not supported:
https://github.com/hydradatabase/hydra/blob/96056312e7c0f413...
"... Columnar supports `btree` and `hash `indexes (and the constraints requiring them) but does not support `gist`, `gin`, `spgist` and `brin` indexes."
* Column-based stores have really fast scans due to compression and vectorization, so you'll generally always read down the column. The way to speed it up is to have "skip indexes" that allow you to skip blocks, e.g., don't even bother to read/decompress them.
* Commonly used indexes need to be very sparse, so they fit in memory even when tables run to hundreds of billions of rows.
* Finally highly compressed columns can be used as indexes to filter data rapidly. ClickHouse calls this PREWHERE processing.
Edit: clarify skip indexes
- https://www.crunchydata.com/blog/the-many-spatial-indexes-of...
- http://postgis.net/workshops/postgis-intro/indexing.html
- Spatial indexes for OSM in PostGIS (PDF) : https://pretalx.com/media/sotm2019/submissions/CAD93S/resour...
https://benchmark.clickhouse.com/#eyJzeXN0ZW0iOnsiQXRoZW5hIC...
I also noticed quite a bit of parity between Hydra and Citus on data set size. Is Hydra a fork of Citus columnar storage?
0 - https://github.com/ClickHouse/ClickBench/blob/main/postgresq...
I found that is common among these types of databases (e.g. Citus, Timescale, etc.) which perform well under very specific conditions, and worse for many (most?) other things, sometimes significantly worse.
That said, Hydra does take up ~17.5G for that benchmark and "PostgreSQL tuned" about 120G, the insert time is ~9 times faster, and "cold run" is quite a bit faster too. It's only "hot run" that shows a fairly small difference. I think it's fair to say Hydra "wins" that benchmark.
> Is Hydra a fork of Citus columnar storage?
Yes: "Hydra Columnar is a fork from Citus Columnar c. April, 2022".
that postgres config is very underpowered, it has only 8 workers per gather while machine has 192 vcpus.
For those who have not experimented with columnar based databases, I would highly recommend toying around with them.
The performance improvements can be substantial. Obviously there are drawbacks involved with integrating a new database into your infrastructure, so it is exciting to see columnar format introduced to Postgres. Removes the hurdle of learning, deploying and monitoring another database.
BTW, Citus license is GNU Affero General Public License (github lists “conditions: same license”) and hydra is Apache. How is that possible if the latter is a fork? There’s probably something about these licenses I’m not aware of and I’m curious.
but, hydra itself is more than just the columnar extension.
Github now has UI for repos with multiple licenses: https://github.blog/changelog/2022-05-26-easily-discover-and... , that would have been clearer for me.
A few months ago, we worked with the team to bring Hydra to Jupyter, you can check out the tutorial here: https://docs.hydra.so/analyze/jupyter
JupySQL's GitHub: https://github.com/ploomber/jupysql
P.S., I think the name conflicts with Hydra, the configuration management library: https://hydra.cc/
[1]: https://www.ory.sh/hydra/
[2]: Not today, tovarisch mayor.
Curious, why not contribute to Citus? Why create a fork and have duplicated effort?
# Requirements
- lz4
- zstd
# Building git clone https://github.com/hydradatabase/hydra
cd hydra/columnar
./configure
make
make install
# Install CREATE EXTENSION IF NOT EXISTS columnar;
The actual extension docs are at https://docs.hydra.so/concepts/using-hydra-columnarhttps://www.citusdata.com/blog/2021/03/06/citus-10-columnar-...
EDIT: per another comment, OP is a fork of Citus Columnar!
do most of your customers replicate their postgres database to Hydra for analytics jobs, or what's the typical set up?
Also, how to migrate data from an existing database? (Is it the usual pg_dump/psql combo?)
(As this is offtopic for the current Show HN, it might be better for to email hn@ycombinator.com if you, or anyone, would be willing to share that way.)
Rows? Rows?!? What's the point to have columnar DB to query rows?
Generally what you do is to scan a column and evaluate a predicate in each value you encounter during the scan (possibly in parallel). For each value of that column that matches the predicate you then keep track of the "position" of the value in the column (a common technique is sparse set data structure such as for example a roaring bitmap). Then you scan through another column and select values for the saved "positions".
As you can see, it's not a stretch to view values from different columns that belong to the same "position" as belonging to the same "row" and the "position" to be the "row index" or "row id"