add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
create table t(b) as select true from generate_series(1,5e4);
create index on t(b);
SELECT 50000
CREATE INDEX
create extension if not exists dblink;--spawning a parallel session
select dblink_connect('_','');
select dblink_send_query('_','begin; update t set b=not b; select pg_sleep(11);');
CREATE EXTENSION
dblink_connect
OK
SELECT 1
dblink_send_query
1
SELECT 1
SELECT pid
, l.locktype
, l.relation::regclass
, left(p.query,12) as query
, p.state
, p.wait_event
, l.mode
, l.granted
FROM pg_stat_activity AS p
JOIN pg_locks AS l
USING(pid)
WHERE pid <> pg_backend_pid() --ignore my own query in pg_stat_activity
pid locktype relation query state wait_event mode granted
787 relation t_b_idx begin; updat active null RowExclusiveLock t
787 relation t begin; updat active null RowExclusiveLock t
787 virtualxid null begin; updat active null ExclusiveLock t
787 transactionid null begin; updat active null ExclusiveLock t
SELECT 4