I had an opportunity to do some tuning on postgresql and was pleasantly surprised at how smoothly it went.
The first thing I did was try to run an “explain” on the query under discussion. (Explain is a tabular or graphical view of the detailed steps the database uses to execute your query. By knowing what path it will take and what tables/indexes it will look at, you can tune your query appropriately.) Knowing this works differently in different databases, I looked up what to do. Here are the steps:
To run explain at the command line:
1) Type “explain” followed by your query. For example “explain select * from table”.
That’s right – one step!
To run explain graphically:
1) Install pgadmin if you haven’t already
2) Type query into editor
3) Choose query –> explain
This shows the graphical view of the query. Clicking on the data output tab shws the text view generated by the command line.
Now it may have changed since then, but I needed to create a separate table the last time I ran an explain in Oracle. This was extra steps that I have to look up each time. db2 had a good graphical explain built into the tool.
What surprised me here was that I figured out postgresql’s explain much faster than Oracle’s. Namely because it was so simple! For the command line version, there is only one step – and it’s not one I am likely to forget.
It’s always nice when software works in such an intutive manner.