Cloudflare Workers and Hyperdrive with PlanetScale is like tomato and basil.
@Jilles4.1K followers
12,681 views
18 Comments
Comments from the original post on X (Twitter)

@fayimora
I don't know how you ended up on my timeline as I only use cloudflare for domain/dns/security type stuff, but I have been really enjoying your content over the last 2 days (I watched the old stuff too). I'll give cloudflare workers(and related services) another go.
2 likes

@Jilles
Appreciate that!!!!
2 likes

@fayimora
Is planetscale the only option for the pg db?

@Jilles
No you can use any MySQL/Postgres database. Even in VPCs on AWS using Workers VPC. But I personally think PlanetScale is the best option for price, performance and scalability.

@fayimora
Thanks for the info. Planetscale probably makes sense for a new db/project, but I don't have the energy/capacity for any db migrations right now haha

@sunglassesface
@kristianfreeman Damn even my fat brain understood this video! Amazing recap of how it works

@Jilles
@kristianfreeman Bro you have a dope AI start up, that brain of yours is excellent BUT APPRECIATE IT
1 like

@StopForumSpam
i cant wait for hyperdrive support to be added to emdash

@atybdot
im interested in "intelligent" part of 'intelligently cache your queries' can you explain me how??

@Jilles
When you write an SQL query it can be parsed as an AST. From that you can infer whether a query can be cached (select * from products) vs when it can’t (insert into … / select * where x < NOW()) I’m not sure about the exact implementation, but that’s my understanding
1 like

@atybdot
Yeah i know that they are only caching select queries But how about filters?? Are they caching queries with every filter too?? Like select x from table where id=e, since= some date etc . How does their query engine decide which select query to cache?

@Jilles
My understanding is every query until you hit Maybe @thomasgauvin can give you a better answer
2 likes

@vibemak
planetscale is great, I might try later on. I currently have VPS server which have plenty space for postgresql db setup, so whether means I could use hyperdrive to connect the postgresql service ran from my vps. I just want to avoid the D1 which pricing based on rows read.

@ejc3
I don't get it. Why wouldn't I just want to connect to a worker in the same AWS data center as my database?

@kalembakonrad
my planetscale db have read replicas, but hyperdrive connects to the primary instance only so how to make use of them?

@russ1anbot
Neat product but sounds like a debugging nightmare.

@its_xlab
Sooo the hard requirement there is a worker, right? Any way to use hyperdrive without spawning a worker, like, from a VPS?

@Jilles
@xlab_os It wouldn’t make much sense from a VPS because you can connection pool already. The query caching also isn’t super useful in that case because you handle requests at your origin anyway.
3 likes