Database Description > Sample Queries

Sample Queries

When to use MDX or SQL

Cross simulation queries
Generally speaking for simple queries that parse out the required data, using either query language is fine, since they are both relatively fast (all around 10 seconds or under). However, for cross simulation and cross protein queries it is advisable to use MDX, since the data are held together in one large "cube". In contrast the data held in the relational database are held in multiple tables. In order to run cross simulation or cross protein queries in SQL requires the use of mutiple table joins which can be tedious especially when looking at a large number of tables. One may also create a "view". A view is a virtual table that is dynamically created and is made up of multiple tables.

Data manipulation
Another point is that queries that run data manipulation or use VBA or EXCEL math functions can be slow in MDX, especially if one wanted to calculate properties of an entire trajectory (20,000+ time frames). In SQL however, the calculations are generally faster. As an example the SQL query to calculate the average phi psi angles using circular statistics (using the SIN, COS, ARCTAN and PI functions) takes around 20 seconds to run on an entire trajectory, whilst in MDX the same query can take several hours. The heavy atom contacts query(in both MDX and SQL) is not advisable to be run over an entire trajectory, as this is an intesive calculation (10-30 seconds per frame). A complete trajectory may take several days. It is preferable to run this query over a relatively short time range of interest , ~100 frames.

MDX Queries

SQL Queries