Display the results returned from an EXPLAIN query in PostgreSQL. Information from the EXPLAIN query is retrieved by using the pg_last_notice function.

The last notice is the last notice for the connection, not the result set, so the data overwritten with each query.

<?php

    // $connect = pg_connect();

    $query = "explain select * from {table}";

    $resultID  = pg_exec($connect,$query);

    $result_text =     pg_last_notice($connect);

    print_r(nl2br($result_text));

?>