I am using PostgreSQL with c++ and I am trying to analyse the performance of different queries. I tried using EXPLAIN ANALYZE but I can't figure out how to print the result on screen. How can I do so?
-
What exactly do you mean with "print the result on screen". When running EXPLAIN ANALYZE, the result returned from the server will be the execution plan. So you'd print it as any other result you obtain through your SQL client. How exactly are you running the EXPLAIN? Which tool are you using?user330315– user3303152011-05-02 09:14:05 +00:00Commented May 2, 2011 at 9:14
-
I tried to print it with: res1 = PQexec(conn, explainQuery.c_str()); for (int i= 0; i < PQntuples(res1); i++) { for (int j = 0; j < nFields; j++) { temp_value = PQgetvalue(res1, i, j); cout << temp_value; } }Performance– Performance2011-05-02 09:53:21 +00:00Commented May 2, 2011 at 9:53
-
Should work as it is "just a result" But I don't do C++, so I cannot tell for sure. Did you try it with psql?user330315– user3303152011-05-02 09:59:16 +00:00Commented May 2, 2011 at 9:59
-
It's weird but the same syntax seems to work now. I guess I messed up while declaring variables or something. Thanks though. :)Performance– Performance2011-05-02 10:13:22 +00:00Commented May 2, 2011 at 10:13
Add a comment
|