Re: alter table xxx set unlogged take long time

2022-07-27 Thread Kyotaro Horiguchi
UNLOGGED evade duping the whole target table and could reduce the amount of WAL to be emitted (caused by the difference of tuple-based WAL and per-page WAL) (in major cases). Could you try it and see if it works for you in any extent? regards. [1] https://commitfest.postgresql.org/38/3461/ -- Ky

Re: Same query 10000x More Time

2022-01-06 Thread Kyotaro Horiguchi
he both hands of a join are on the same foreign server. Tthis is not the case since the inner subquery is not even a foreign scan. The planner doesn't consider the possibility that a subquery is executable anywhere. As the result, the local inevitably draw all rows from remote table to join with the result of the subquery on-local, which should be quite slow. It could be improved, but I don't think we are going to consider that case because the SLOW query seems like a kind of bad query, which can be improved by rewriting to the FAST one. regards. -- Kyotaro Horiguchi NTT Open Source Software Center

Re: Pg_locks and pg_stat_activity

2020-12-03 Thread Kyotaro Horiguchi
lly queries run fast and with low > >> cost when ran from Database 'psql' or pgadmin. However when called from API > >> Average Time in pg_stat_statements shows more than 1 second. When Load test > >> runs these queries get concurrently called ,response time beomes poor with > >> more load. Could this be due to Lockings. > >> > >> > >> I checked pg_locks and I see the below records. Query that I used is also > >> given below. I could see few ExclusiveLocks for "virtualxid" records and > >> for queries with CTEs(WITH Clause). Please advise > >> > >> > >> > >> SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa > >> ON pl.pid = psa.pid; You would find that the "granted" column in all the rows from pg_locks is "true", that is, no one is waiting on a lock. That slowdown doesn't at least seem coming from lock conflict. regards. -- Kyotaro Horiguchi NTT Open Source Software Center

Re: Replication lag due to lagging restart_lsn

2020-08-19 Thread Kyotaro Horiguchi
to preserve WAL files up to about 68GB (in the case where checkpoint_timeout is 5 minutes) so requirement of 7GB by restart_lsn doesn't matter. In short, I don't think you need to do something against that "lag". regards. -- Kyotaro Horiguchi NTT Open Source Software Center

Re: UNION causes horrible plan on JOIN

2019-10-28 Thread Kyotaro Horiguchi
d) where rt.thesaurus_id = $1 union ... $$ language sql; explain analyze select c.version_id from hitlist_rows_103710241 h, lateral the_view(h.objectid) as c; regards. -- Kyotaro Horiguchi NTT Open Source Software Center