Thread: simple explain output.

simple explain output.

From
Chris
Date:
Hi all,

I'm pretty sure the answer to this is "not possible" but I'll ask just
in case.

Is there a way to simplify the output that comes from explain?

I'm writing a script to check my database logs to see whether I am
missing any indexes.


Basically the process goes like this:

- Find a select query in the logs
- Run it through the database using 'explain'
- Check whether it's using an index scan or "other"


Yes, I know not every query is going to use an index, but this will cut
down on the queries I have to check.

At the moment the explain output can get complicated to parse and
process, so I'm trying to think of another approach to use.

Any suggestions are welcome :)

Chris.

Re: simple explain output.

From
Andreas Seltenreich
Date:
Chris writes:

> At the moment the explain output can get complicated to parse and
> process, so I'm trying to think of another approach to use.
>
> Any suggestions are welcome :)

I think the solution is using debug_print_plan (a guc variable).
You can use it to get machine-readable plans in the logs and/or
via a client connection depending on the client_min_messages and
log_min_messages setting.

regards,
Andreas
--