Hot answers tagged

2 votes

How are HashAggregate row estimates calculated?

Row estimates come first, they don't depend on the node type. So a group aggregate (aka ordered aggregate) that aggregates the same data would have the same row estimate. 200 is the default row ...
user avatar
  • 32.7k
2 votes
Accepted

Oracle How to get Execution Plan for SQL executed inside of PLSQL?

You can look up the sql_id And child_number in v$sql. Something like: Select s.sql_id, s.child_number From V$sql s Where upper(sql_text) like upper('SELECT COUNT(%FROM foo') And Sql_text not ...
user avatar
  • 2,475
2 votes

Postgresql explain alter table add column doesn't work

The documentation clearly stats: statement Any SELECT, INSERT, UPDATE, DELETE, VALUES, EXECUTE, DECLARE, CREATE TABLE AS, or CREATE MATERIALIZED VIEW AS statement, whose execution plan you wish to ...
user avatar
2 votes
Accepted

Postgresql explain alter table add column doesn't work

From the documentation: https://www.postgresql.org/docs/9.1/sql-explain.html, there is no EXPLAIN for ALTER command. Important: Keep in mind that the statement is actually executed when the ANALYZE ...
user avatar
  • 1,522
1 vote
Accepted

Postgres changes query plan for prepared statement to something poor after multiple invocations

It thinks the generic plan you show (with the $1 in it) will be slightly faster than the custom plan (with the actual value in it), 104.57 vs 105.26. So after running a number of custom plans and ...
user avatar
  • 32.7k
1 vote

logging EXPLAIN output of slow queries in MySQL

MySQL does not have a feature to EXPLAIN all the queries in the slow query log as far as I know. This would be risky to do during logging, because some queries can be costly to the server even if you ...
user avatar
  • 10.1k
1 vote

logging EXPLAIN output of slow queries in MySQL

MySQL has log_slow_extra which includes some session status variables per this manual page, however its not equivalent to an explain. If you are using MariaDB then EXPLAIN in the Slow Query Log is ...
user avatar
  • 6,439
1 vote
Accepted

Get explain plan for query with inline function

The parentheses around the statement are wrong. It is explain plan for stmt and not explain plan for (stmt); db<>fiddle
user avatar
1 vote

Postgres slow exists subquery

This is pretty easy to explain. You are looking for the first job belonging to an unlocked queue (which meet some other criteria as well, but apparently those are easy to meet, as well as not meeting ...
user avatar
  • 32.7k

Only top scored, non community-wiki answers of a minimum length are eligible