pgQuilt

What is it?

pgQuilt is my entry to the PostgreSQL Android Application Contest - June/July 2010

I don't have an Android phone, so development was with the emulator. I was excited after watching Google I/O videos and thought I'd like to get into Android development, so this is my first Android application. Hopefully the judges will say "Give that man an Android Phone!" so that I can produce more useful applications.

What does it do?

pgQuilt makes use of tree mapping to show the disk space used by the PostgreSQL schemas and tables, using a different colour for row data, toast, and indexes.

I wanted to create an application for PostgreSQL that makes sense as an Android application. The way I see pgQuilt meeting that need, is that a PostgreSQL DBA can very quickly and easily check on the status of their database. A future version will include the ability to show differences from one check to the next, and display changes over time, even further helping to show a DBA the possible reason why they're having to check on their database while out and about.

The Tree Mapping implementation uses the "Squarified" tiling algorithm, an unoptimised version of which is described in a paper by Mark Bruls, Kees Huizing, and Jarke J. vanWijk.

What does it look like?

More screen shots are available.

What is its History?

The version I submitted to the contest judges was v1.1, which wasn't as complete as I'd have liked. In particular it was limited to a single categorisation and a single weighting.

In my submission, I said that I had run out of time, and that I'd have liked the first release to include:

  1. To be able to select different weighting factors, from stats and system catalogs, such as correlation, null fraction, tuples read/written/cache hits from io stats.
  2. To be able to select different categorisation schemes, such as owner or tablespace.
  3. Have another heirarchy of user, connection, and show usage, with possible weightings and categories of number of locks, query execution time, query status.
  4. Store the results and be able to show weightings based on the difference between the last check, and the current one.
  5. To be able to completely customise the SQL (with built in guidance) to allow for tree mapping of your own desires.
  6. Maintain and select from a list of multiple database connections.

Since submitting it, I've continued working on the code, working on these missing features, and I've finished those first two missing features. (The number of weighting factors is still very limited, but it is now entirely based on SQL results.)

I've also got it caching (while running) the last results and rendered bitmaps, so changing the orientation of your device no longer results in requerying your database... If that doesn't work for you... "you're holding it wrong".

I'm releasing v1.2 with a question for anyone using it: What weightings and categories would you like to see?

Update 2010-07-24...

I've a friend staying for a week with an HTC Desire, so I can finally see my application running on a real phone! Unfortunately the "Refreshing" progress dialog stayed open on top of the dialog that would let you chose demo mode, or to set up the connection settings!

The slow part of "rendering" (at least on the emulator) is drawing the text over the background, so in v1.3 it shows the background as soon as it is ready, then updates it when the text is overlaid.

How can I use it?

I designed the tree mapping code within pgQuilt to be useful to other projects. The implementation is a single View, with the size of all contained areas calculated during the layout call, and a background ASyncTask started to render the background. The foreground is only used to show the selected node.

The license is The PostgreSQL License.

It includes the PostgreSQL JDBC driver, slightly modified to work with Android's JDBC interface.

Where can I get it?

Version 1.3 of the application is available here: pgQuilt.apk.

The source code of Version 1.2 is available here: pgQuilt.1.2.src.zip.