Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgbadger can't parse CSV format auto_explain plan #825

Open
zxwsbg opened this issue May 15, 2024 · 2 comments
Open

pgbadger can't parse CSV format auto_explain plan #825

zxwsbg opened this issue May 15, 2024 · 2 comments

Comments

@zxwsbg
Copy link

zxwsbg commented May 15, 2024

I set following params:

log_destination = 'csvlog'
log_filename = 'postgresql-%d-%H.log'
logging_collector = 'on'
auto_explain.log_min_duration=0
auto_explain.log_analyze=true
auto_explain.log_format='text'
shared_preload_libraries='auto_explain'

And I found pgbadger can't parse CSV format LOG pretyfully.

image

When I change log_destination to 'stderr', pgbadger can parse LOG correctly.
image

@darold
Copy link
Owner

darold commented May 15, 2024

Please can you post a line from your csvlog with a query and auto_explain output ?

@zxwsbg
Copy link
Author

zxwsbg commented May 15, 2024

Please can you post a line from your csvlog with a query and auto_explain output ?

csv output :

2024-05-15 11:54:08.146 UTC,"postgres","postgres",13215,"[local]",6644a260.339f,1,"SELECT",2024-05-15 11:54:08 UTC,3/2,0,LOG,00000,"duration: 52.114 ms  plan:
Query Text: select * from t where a=32;
Gather  (cost=1000.00..10633.43 rows=1 width=4) (actual time=0.270..52.105 rows=1 loops=1)
  Workers Planned: 2
  Workers Launched: 2
  ->  Parallel Seq Scan on t  (cost=0.00..9633.33 rows=1 width=4) (actual time=31.724..48.541 rows=0 loops=3)
        Filter: (a = 32)
        Rows Removed by Filter: 333333",,,,,,,,"explain_ExecutorEnd, auto_explain.c:422","psql","client backend",,0

And my stderr output:

2024-05-15 11:56:33.470 UTC [15449] LOG:  00000: duration: 51.182 ms  plan:
        Query Text: select * from t where a=32;
        Gather  (cost=1000.00..10633.43 rows=1 width=4) (actual time=0.265..51.173 rows=1 loops=1)
          Workers Planned: 2
          Workers Launched: 2
          ->  Parallel Seq Scan on t  (cost=0.00..9633.33 rows=1 width=4) (actual time=31.170..47.669 rows=0 loops=3)
                Filter: (a = 32)
                Rows Removed by Filter: 333333

My command is

pgbadger -q postgresql-15-11.csv(log) -o a.html -j 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants