support fix query_id for temp table

2024-01-31 Thread ma lz
session 1:
create temp table ttt ( a int );
insert into ttt values(3); -- query_id is XXX  from 
pg_stat_activity


session 2:
create temp table ttt ( a int );
insert into ttt values(3);-- query_id is YYY  from 
pg_stat_activity



I know temp table has different oid, so query_id is different, is there a way 
to use table name for temp table  instead of oid?




Why not do distinct before SetOp

2024-11-04 Thread ma lz
some sql like ' select a from t1 intersect select a from t1 '

if t1 has large number rows but has few distinct rows

select distinct a from t1 intersect select distinct a from t1;― this is 
faster than origin sql

can postgres do this optimize during plan-queries?