frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Japanese rice is the most expensive in the world

https://www.cnn.com/2026/02/07/travel/this-is-the-worlds-most-expensive-rice-but-what-does-it-tas...
1•mooreds•22s ago•0 comments

White-Collar Workers Made the Switch to a Trade

https://www.wsj.com/lifestyle/careers/white-collar-mid-career-trades-caca4b5f
1•impish9208•22s ago•1 comments

The Wonder Drug That's Plaguing Sports

https://www.nytimes.com/2026/02/02/us/ostarine-olympics-doping.html
1•mooreds•45s ago•0 comments

Show HN: Which chef knife steels are good? Data from 540 Reddit tread

https://new.knife.day/blog/reddit-steel-sentiment-analysis
1•p-s-v•54s ago•0 comments

Federated Credential Management (FedCM)

https://ciamweekly.substack.com/p/federated-credential-management-fedcm
1•mooreds•1m ago•0 comments

Token-to-Credit Conversion: Avoiding Floating-Point Errors in AI Billing Systems

https://app.writtte.com/read/kZ8Kj6R
1•lasgawe•1m ago•1 comments

The Story of Heroku (2022)

https://leerob.com/heroku
1•tosh•1m ago•0 comments

Obey the Testing Goat

https://www.obeythetestinggoat.com/
1•mkl95•2m ago•0 comments

Claude Opus 4.6 extends LLM pareto frontier

https://michaelshi.me/pareto/
1•mikeshi42•3m ago•0 comments

Brute Force Colors (2022)

https://arnaud-carre.github.io/2022-12-30-amiga-ham/
1•erickhill•5m ago•0 comments

Google Translate apparently vulnerable to prompt injection

https://www.lesswrong.com/posts/tAh2keDNEEHMXvLvz/prompt-injection-in-google-translate-reveals-ba...
1•julkali•6m ago•0 comments

(Bsky thread) "This turns the maintainer into an unwitting vibe coder"

https://bsky.app/profile/fullmoon.id/post/3meadfaulhk2s
1•todsacerdoti•7m ago•0 comments

Software development is undergoing a Renaissance in front of our eyes

https://twitter.com/gdb/status/2019566641491963946
1•tosh•7m ago•0 comments

Can you beat ensloppification? I made a quiz for Wikipedia's Signs of AI Writing

https://tryward.app/aiquiz
1•bennydog224•8m ago•1 comments

Spec-Driven Design with Kiro: Lessons from Seddle

https://medium.com/@dustin_44710/spec-driven-design-with-kiro-lessons-from-seddle-9320ef18a61f
1•nslog•8m ago•0 comments

Agents need good developer experience too

https://modal.com/blog/agents-devex
1•birdculture•10m ago•0 comments

The Dark Factory

https://twitter.com/i/status/2020161285376082326
1•Ozzie_osman•10m ago•0 comments

Free data transfer out to internet when moving out of AWS (2024)

https://aws.amazon.com/blogs/aws/free-data-transfer-out-to-internet-when-moving-out-of-aws/
1•tosh•11m ago•0 comments

Interop 2025: A Year of Convergence

https://webkit.org/blog/17808/interop-2025-review/
1•alwillis•12m ago•0 comments

Prejudice Against Leprosy

https://text.npr.org/g-s1-108321
1•hi41•13m ago•0 comments

Slint: Cross Platform UI Library

https://slint.dev/
1•Palmik•17m ago•0 comments

AI and Education: Generative AI and the Future of Critical Thinking

https://www.youtube.com/watch?v=k7PvscqGD24
1•nyc111•17m ago•0 comments

Maple Mono: Smooth your coding flow

https://font.subf.dev/en/
1•signa11•18m ago•0 comments

Moltbook isn't real but it can still hurt you

https://12gramsofcarbon.com/p/tech-things-moltbook-isnt-real-but
1•theahura•22m ago•0 comments

Take Back the Em Dash–and Your Voice

https://spin.atomicobject.com/take-back-em-dash/
1•ingve•22m ago•0 comments

Show HN: 289x speedup over MLP using Spectral Graphs

https://zenodo.org/login/?next=%2Fme%2Fuploads%3Fq%3D%26f%3Dshared_with_me%25253Afalse%26l%3Dlist...
1•andrespi•23m ago•0 comments

Teaching Mathematics

https://www.karlin.mff.cuni.cz/~spurny/doc/articles/arnold.htm
2•samuel246•26m ago•0 comments

3D Printed Microfluidic Multiplexing [video]

https://www.youtube.com/watch?v=VZ2ZcOzLnGg
2•downboots•26m ago•0 comments

Abstractions Are in the Eye of the Beholder

https://software.rajivprab.com/2019/08/29/abstractions-are-in-the-eye-of-the-beholder/
2•whack•26m ago•0 comments

Show HN: Routed Attention – 75-99% savings by routing between O(N) and O(N²)

https://zenodo.org/records/18518956
1•MikeBee•26m ago•0 comments
Open in hackernews

How often is the query plan optimal?

https://vondra.me/posts/how-often-is-the-query-plan-optimal/
32•eatonphil•7mo ago

Comments

alexisread•7mo ago
TBH this is a good case for Linq-style queries, over SQL-based ones. Linq style allows you to narrow the query deterministically vs Sql eg. Mytable1.select().where().join(mytable2)

This applies the filter before the join, compared with:

Select from mytable1 join mytable2 on... Where...

Which relies on the query plan to resolve the correct application of where, and hope it puts the where before the join.

This becomes more important in the cloud, where Iceberg tables cannot be benchmarked in the same way as single-cluster relational DBs.

brudgers•7mo ago
When you are willing to pay for your RDBMS, you are likely to get an optimizer that does algebra for you (and does algebra pretty well).

On the other hand, if you are hand coding the query, you are hand coding whether you use SQL, Linq, or anything else. And a strength of SQL is a robust ecosystem of documentation, tools, employment candidates, and consultants.

gigatexal•7mo ago
exactly, one often gets what they pay for.

databases are complicated beasts and tens of thousands if not more working years of the smartest people have been working on them since the 70s

hyperpape•7mo ago
> databases are complicated beasts and tens of thousands if not more working years of the smartest people have been working on them since the 70s

Yes, but they've also set themselves a much harder problem. Instead of "find the proper execution for this particular query, armed with all the knowledge of the database you have" they have the problem of "find the proper execution for all possible queries, using only information that's encoded in DB statistics."

So it's no surprise that it's quite easy to find places the optimizer does silly things. To take one instance that bit me recently: or clauses representing different tables cannot be optimized well at all in postgres (https://www.cybertec-postgresql.com/en/avoid-or-for-better-p...).

I'd still rather have optimizers than not--the optimizer does well most of the time, and my current work has far too many queries to hand-optimize. But you do end up seeing a lot of poorly optimized queries.

gigatexal•7mo ago
That’s right. The better one is able to help the optimizer the better life is. It’s an art not a science.
gigatexal•7mo ago
but SQL execution even in a dumb planner is FROM then WHERE then .... and then finally SELECT and ORDER

so I don't get it

gonzalohm•7mo ago
But a smart query planner would move the where condition into the JOIN condition
Sesse__•7mo ago
Depending on the join type, moving it up into the join (instead of keeping it on the table) would be either irrelevant or actively harmful.
hobofan•7mo ago
Both SQL and Linq-style queries end up in the same in-memory representation once they hit the query engine/query planner.

Filter pushdown ("correct application of where, and hope it puts the where before the join") is table stakes for a query planner and has been for decades.

And no, Iceberg tables are not special in any way here. Iceberg tables contain data statistics, just like the ones described in the article to make the optimizer choose the right query plan.

Sesse__•7mo ago
Filter pushdown is surprisingly subtle, when you start getting into issues of non-inner joins and multiple equalities. I had no idea until I had to implement it myself. (It's also not always optimal, although I don't offhand know of any optimizer that understands the relevant edge cases.)
adamzochowski•7mo ago
This depends on the join type.

    select ...
    from table1 
        left join mytable2 on ... 
    where ..
If you move contents of where clause to the join/on clause, you will change meaning of the query.

If someone has a complex query or complex performance, they could do either subselects

    select ...
    from ( select ... from table1 where ... ) as table1_filtered
        inner join mytable2 on ... 

or CTEs

    with table1_filtered as ( select ... from table1 where ... ) 
    select ...
    from table1_filtered
        inner join mytable2 on ...
remus•7mo ago
An interesting article, but I disagree with the first sentence.

> The basic promise of a query optimizer is that it picks the “optimal” query plan.

This is kind of true, but the optimiser has to do all this with very tight constraints on available time and resources. A planner that returned a perfect plan every time would be useless if it took 500ms and 500mb, so I'd say a better phrasing would be

> The basic promise of a query optimizer is that it picks a good plan most of the time and does it quickly and efficiently.

wat10000•7mo ago
I imagine that finding the optimal query plan would itself be at least NP-complete in the worst case, so you’ll definitely want to settle for “good” rather than optimal.
Sesse__•7mo ago
Under fairly reasonable circumstances, finding the optimal join order for N tables in an arbitrary query graph is indeed shown to be NP-hard. However, many common queries are not so difficult, e.g. if you just join A to B, B to C, C to D etc. (a chain join) and allow joining only along join conditions, it's O(n³). But e.g. a star join (A to B, A to C, A to D, etc.) can become much worse IIRC.
marcosdumay•7mo ago
> The basic promise of a query optimizer is that it picks a good plan most of the time and does it quickly and efficiently.

Hum, no. The basic promise of a query optimizer is that it picks a good plan all of the time. Otherwise it's worse than useless and you would be better with a DB where you can pin the plan for every query.

But yes, the goal is on "good", not "optimal".

RaftPeople•7mo ago
> The basic promise of a query optimizer is that it picks a good plan all of the time.

The poster you responded to is correct, it's a combinatorial problem that can't be expected to pick a good plan all of the time within the normal data and time constraints.

bob1029•7mo ago
> Is there a plausible way to improve this?

Yes. There are techniques in high end RDBMS like adaptive query processing which allow for the engine to update its approach during execution.

https://learn.microsoft.com/en-us/sql/relational-databases/p...

https://www.ibm.com/docs/en/i/7.6.0?topic=overview-adaptive-...

https://apex.oracle.com/pls/apex/features/r/dbfeatures/featu...

to11mtm•7mo ago
After years of watching DBAs, 'Rerun Stats' is the equivalent of 'hitting the space station with a wrench' for an Oracle DB lol.
mike_hearn•7mo ago
Stats based query planning is really useful for ad-hoc queries where you don't care exactly how fast it runs, you just want it to be as fast as possible with as little thought put into the query as possible. Given that originally SQL was meant to be used by humans, its dependence on planners makes sense.

For queries issued by machines where predictability is the most important thing, it probably makes sense to hard-code plans or at least pin a plan so it can't change out from underneath you at midnight in production. I'm not sure about Postgres, but you can do this on Oracle DB. There's probably a better way to express schemas in which both indexing and plans can be constructed ahead of time in many cases where the developer already knows the likely distribution of data, and not having performance cliffs is more important than the convenience of the planner. Example:

@Entity class SomeTable { @Mostly("SUCCESSFUL", "FAILED") SomeEnum row; }

and then the DB mapper - not necessarily an ORM - could provide the query hints needed to force the DB onto a reasonable plan for the annotated distribution.

williamdclt•7mo ago
> I'm not sure about Postgres

Not possible. It’s explicitly a non-goal, sub-optimal plans are considered a bug to be fixed, you can’t even force the use of an index.

To their credit, the Postgres query planner is amazing and does generally work very well that you don’t need forcing indexes or plans. But that’s little comfort when it does not and you have a production incident on your hands

Edit: I think RDS Aurora Postgres does let you have managed query plans

barrkel•7mo ago
It's not really true. There are many session-scoped flags you can set which influence planner behavior, and sometimes toggling them for a specific query is what gets you through. More often, judicious use of CTEs as an optimization barrier (materialized CTE in moderrn versions) is useful to force execution order.

I like that Postgres has a lot of tools at its disposal for executing queries. But you can't rely on it for data even with modest scale. It's rare that it does a good job with interesting queries.

williamdclt•7mo ago
I think we’re saying the same thing: you can’t force PG to a plan or an index, you can only change your query in hope it gets the hint.

Even session scoped flags are a really coarse tool, don’t guarantee you’ll get the plan you want and it might unexpectedly impact other queries in the session.

Materialised CTE are one of the only tools that give real control, but an optimisation barrier is often the opposite of what you want

atsjie•7mo ago
> the Postgres query planner is amazing

Let's agree to disagree.

It's becoming too complex, too unpredictable. Every query and variable becomes a surprise in production. It's too smart for its own good.

williamdclt•7mo ago
We don’t entirely disagree tbh. But having to work with MySQL now, I find I’m more surprised by how bad it is than I am by Postgres being too smart for its own good. I dont love everything about Postgres at all, but I always end up thinking it’s the least bad option
atombender•7mo ago
You can with the pg_hint_plan extension: https://github.com/ossc-db/pg_hint_plan
to11mtm•7mo ago
Optimal Query plans are often a bit of voodoo dependent on the underlying DB.

That said, I've certainly seen anti patterns in querying; my favorite being folks who bolt an ORM on, don't bother to define mapping properly, and suddenly everything tanks because reasons[0]

But also, I've found over time that for DB's that get a lot of 'specific' traffic, frankly it's nice to abuse an ORM's behavior of treating certain things as literals instead of parameterizing them.

[0] - Main examples that come to mind are parameter mismatches, either sending unicode for what's non unicode in the DB, or having a default length based on the column size but the column size is unspecified in mapping so it treats it as VARCHAR(MAX). Both of these can break index usage in DBs.