Launch HN: Hydra (YC W22) – Query any database via Postgres (hydras.io)
Different databases are good at different things. For example, Postgres is good at low-latency transactional workloads, but slow when running analytical queries. For the latter, you're better off with a columnar database like Snowflake. The problem is that for each new database added to a system, application complexity increases quickly.
Working at Microsoft Azure, I saw many companies juggle database trade-offs in complex architectures. When organizations adopted new databases, engineers were forced to rewrite application code to support the new database or use multiple apps to offset database performance tradeoffs. All this is expensive busy work that frustrates engineers. Adopting new databases is hard and expensive.
Hydra automatically picks the right DB for the right task and pushes down computation, meaning each query will get routed to where it can be executed the fastest. We’ve seen results return 100X faster when executing to the right database.
We've chosen to integrate with Snowflake first so that developers can easily gain the analytical performance of Snowflake through a simple Postgres interface. To an application, Hydra looks like a single database that can handle both transactions and analytics. As soon as transactions are committed in Postgres, they are accessible for analytics in real-time. Combining the strengths of Postgres and Snowflake in this way results in what is sometimes called HTAP: Hybrid Transactional-Analytical Processing (https://en.wikipedia.org/wiki/Hybrid_transactional/analytica...), which is the convergence of OLTP and OLAP.
Existing solutions are manual and require communicating with each datastore separately. The common alternative is trying to combine all of your data together into a data warehouse via ETL. That works well for analysts and data scientists, but isn't transactional and can't be used to power responsive applications. With Hydra engineers can write unified applications to cover workloads that had to be separate before.
Hydra runs as a Postgres extension, which gives it the ability to use Postgres internals and modify execution of queries. Hydra intercepts queries in real-time and routes queries based on query type, user settings, and Postgres' cost analysis. Writes and operational reads go to Postgres, analytical workloads go to Snowflake.
Recently committed transactions are moved from Postgres to Snowflake in near real-time using Hydra Bridge, our built-in data pipeline that links databases from within Postgres. The bridge is an important part of what we do. Without Hydra, workloads are typically isolated between different databases, requiring engineers to implement slow and costly ETL processes. Complex analytics are often run on older data, updated monthly or weekly. The Hydra bridge allows for real-time data movement, enabling analytics to be run on fresh data.
We make money by charging for Hydra Postgres, which is a Postgres managed service, and Hydra Instance, which attaches Hydra to your existing Postgres database. Pricing is listed on the product pages: https://hydras.io/products/postgres and https://hydras.io/products/instance.
A little about our backgrounds: Joseph Sciarrino ...
77 comments
[ 4.6 ms ] story [ 129 ms ] thread1.) Can you talk a bit about how this is better that the existing foreign data wrappers Postgres has available?
2.) Any thoughts on S3 support? More and more I see teams using S3 as a data store for certain specific use cases.
We will definitely think about S3 support! Would love to understand those use cases more and how Hydra could help.
Is this through FDW's? Would love to hear more about the technical details.
Shameless plug -- I work at Hasura (turn DB's into GraphQL API's) and this seems incredibly synergistic and useful to get access to databases we don't have native drivers for at the moment.
Any chance of an OSS limited version?
Hydra does not use FDWs except for Postgres-to-Postgres communication (for now). What we found was that FDWs do not do pushdown very well, even when Postgres has full information. You can get FDWs to push down aggregations, but complex queries with subqueries etc quickly get slow again. In short, our goal is to have your queries take full advantage of the power of each datastores, and we found that FDWs do not accomplish that goal.
We want to support GraphQL at some point, so same goes for us!
We are thinking about an OSS version, I think how we do "limited" is a big part of what that means. What would you like to see in an OSS version? What would you use it for?
Read-only access might be one way, but I'm unsure how popular that would be.
Generating GraphQL API's for other datasources by funneling them through PostgresI know that EnterpriseDB is heavily invested in FDW development and core Postgres stuff, so maybe we'll see some more neat stuff come out of that team that makes it upstream.
[0] https://www.splitgraph.com/blog/postgresql-fdw-aggregation-p...
"Splitgraph connects numerous, unrelated data sources into a single, unified SQL interface on the Postgres wire protocol."
Just my 2 cents.
The basic pitch is for a "Unified Data Stack – an integrated and modern solution for working with data without worrying about its infrastructure." Connecting unrelated data sources is one part of the product, but it also includes a data catalog, modeling, integration, warehousing...
By integrating the discovery, access and (optionally) storage layers, we reduce the friction for a lot of common workflows, kind of like GitLab does by bundling CI pipelines and version control. Even if each layer has some tradeoffs, the benefit of integrating them has a multiplicative effect on the platform itself. And if you need a more specialized provider for one layer, that's fine too – the "data middleware" model makes Splitgraph incrementally adoptable.
But yeah... marketing is hard, especially in the "bag of tools" stage of product/market fit when the optimal messaging can differ so much by use case. Thanks for your suggestion!
1 - https://steampipe.io 2 - https://github.com/turbot/steampipe 3 - https://hub.steampipe.io/plugins
If it's OSS, I am definitely interested in experimenting with this. Maybe I can write a blogpost or something?
(I see your company has some pretty big costumers, but I suppose you're not just selling them a cloud version of Steampipe)
Steampipe Cloud [2] is in private preview providing a hosted version of Steampipe (and more). We're iterating fast and would love your feedback :-)
1 - https://turbot.com 2 - https://cloud.steampipe.io
We are really excited about the prospect of bringing SQL and NoSQL together!
One question I have is how to Hydra balances writing postgres scripts vs leveraging system-specific features. For example, I remember going through Snowflake's documentation and found interesting functions for data aggregation. Can I leverage Snowflake-specific features when using Hydra?
You can use our manual router[1] to route queries that use a specific syntax or functions. The way this works today is you wrap your query in an SQL function. In the future, we could detect use of a specific features and route those queries appropriately. I think there might be other ways to solve this as well e.g. by having a 'stub' aggregate function in Postgres for the function you want to call. We are working with customers to iterate on issues like this as they occur.
[1]: see "Manual Routing" at https://hydras-io.notion.site/Router-a91f5282f1354c54a9ba894...
I've had (early in their career) analysts report to me that struggle writing optimal queries across relational, non-relational, & graph DBs (they're usually great at one & mediocre on others). This will be a huge for them & our stakeholders who rely on them to get them trustworthy insights.
Back in my consulting days, I built a distributed query system based on Presto to integrate some custom/onprem data sources with more distributed/cloudy ones, Hive and such, and it worked well for that, too. Most of that was also ad-hoc, batch, or event-driven analytics, too, but there were plans for supporting production workloads.
I think maybe one reason people shy away from things like Presto (and the above) is the uneven performance guarantees; waiting for an unoptimized Hadoop or Orcfile query by accident because you joined on something or another is fine for one-offs, but might become costly in prod workflows.
Right, so my question is: how is that solved with Hydra? Seems like you'd arrive at the same issue?
[1]: https://metriql.com
I once started building as a side project something similar but focused on querying cloud resources (like S3 buckets, ec2s, etc... discovering the biggest file from a bucket was trivial with this). I abandoned the project but someone else built a startup on the same concept - even the name was the same: cloudquery.
I built it using the multicorn [1] postgres extension and it is deligthful of how easy it to get something simple running.
[1] https://multicorn.org/
One of the ideas I kicked around was “materialize-on-read” - when a query comes in but the underlying data is stale, refresh the views first then serve the query.
I’m wondering how much state you plan to put into the Hydra layer or if you plan to keep it mostly a router.
Generally all that is required to connect to multiple data sources from CSV to Elasticsearch is just writing a JSON configuration file. Then can get SQL access via JDBC with the able to join all those sources together.
Unfortunately, I would not be too surprised if the query execution Calcite was found to be less performance-optimized than Hydra. There is ongoing work for improvement there. That said, there are users of Calcite at Google, Uber, Spotify, and others who have made great use of various parts of the framework.
[0] https://calcite.apache.org/
The primary advantage of Calcite for connecting multiple data sources are 1) easily joining data sources that use completely different APIs (assuming there is a Calcite adapter available) and 2) supporting more complex queries than the original data source supports without having to write code (other than SQL) to do the processing.
And the project being founded by someone who has written multiple RDBMS.
Calcite is a wonder.
1) https://oss.gitsense.com/insights/github?q=pull-age%3A%3C%3D...
I am using it as the backbone for my hobby project that auto-generated federated GraphQL API's:
https://github.com/GavinRay97/GraphQLCalcite
The experience has been incredibly positive and the community has been incredibly helpful & supportive. It's one of the coolest technical projects I've ever seen and has sparked my interest in query engines and relational databases.
I posted some JMH benchmarks of an app that parses a GraphQL query, converts it to Calcite relational expressions, and then executes it against an in-memory DB and it ran on the orders of milliseconds:
https://lists.apache.org/thread/hofjx628864t0kt4kk8vo4tjfrxb...
Something very similar to Calcite but much lesser-known is the "Teiid" project:
https://github.com/teiid/teiid
Highly recommend checking the code out. It's got a brilliant query optimizer/planner tailored to cross-datasource queries, a cache system, and a translator architecture that can convert a generic SQL dialect to dozens of SQL/NoSQL flavors.
Also integrates other data sources like REST API's, S3, flat files etc as queryable data sources.
For example, I have a former student who's been working on an adapter to Apache Arrow. Beyond having a fast execution engine, this should also eventually enable Calcite to work pretty seamlessly with other systems using Arrow without serialization overhead.
He's one of the only people I know that's a committer/PMC of both Arrow and Calcite, super nice and brilliant guy.
Maybe he'd have good feedback or ideas around this?
https://twitter.com/intjesus
I'm currently using Postgraphile[0], which uses Postgres' introspection API to discover the schema structure.
Would this still work with Hydra?
[0] https://www.graphile.org/postgraphile/
Definitely nice work though and best of luck!
Our "no lock-in" claim refers to your data, since Hydra is Postgres, you're not stuck using "HydraDB" forever -- it's relatively easy to migrate in or out since you can use well established Postgres tools. We also are open to licensing the product should you wish to self-host, on-prem, etc.
[0]: https://github.com/authzed/spicedb
Does this mean the data is duplicated to all the available storage backends?
- How does this deal with specifics of the query languages of the different data stores? I'm not an expert with Snowflake, but I suppose it supports specific querying capabilities not found in Postgres' SQL dialect. How are those exposed to Hydra users?
- I'm confused by "As soon as transactions are committed in Postgres, they are accessible for analytics in real-time" vs. "Recently committed transactions are moved from Postgres to Snowflake in near real-time". Is data propagated to Snowflake synchronously or asynchronously? I.e. is it guaranteed that data can be queries from Snowflake right the next moment after a transaction has been committed (as suggested by the former) or not (as suggested by the latter)?
Disclaimer: I work on Debezium, another solution people use for propagating data from different databases (including Postgres) into different data sinks (including Snowflake)
Today, queries need to be Postgres-compatible to be intelligently routed, but queries with specific query syntax or functions beyond Postgres can be routed with our manual router[1]. This is our first solution to this problem and plan to iterate in response to customer pain.
Sorry for the confusion! Data moves asynchronously -- we're not trying to implement multi-phase commits -- but we can act on data very quickly once committed. Our solution here uses Postgres logical replication. Using the Data Bridge is optional and a customer's existing solutions are welcome as well.
[1]: https://hydras-io.notion.site/Router-a91f5282f1354c54a9ba894...
Will be following.
Definitely a lot of potential, and also a lot of potential gotchas.
Translating from one SQL syntax (e.g. Postgres) to others, while maintaining the full capability of the other system, for example, turned out to be quite complex (but doable).
Will be following your project and wish you all the best. I suspect if you keep things sharp/focused and don't go too crazy with promises or uses cases, this could be quite successful.
Is this going to stay an intelligent router and sort of proxy? Or do you have plans for federated, heterogeneous joins, for example?
That's where things get interesting :) I think there's a lot you can do without even having to go that far.