Kellyn Gorman brings in the usual suspects:
“How does the database identify this query and its execution plan?”
Both Oracle and PostgreSQL answer this question, but I find they do it in very different ways, reflecting fundamentally different design philosophies around optimization, observability, and stability. As I dive into this rabbit hole once again, I’m going to reflect on how Oracle’s SQL_ID differs from the query_id in PostgreSQL and how two terms that sound so similar (PLAN_HASH_VALUE and query_hash) could be generated so differently, as well as misinterpreted. I’m guilty of it myself, so it’s a good place to spend some time.
Read on for the answer.