Domino Development - Back to Basics - Part 4: Domino views are different
Continuing from Part 3, this part is typically the hardest to understand when coming from an RDBMS background. So take your time.
Next up: Finding data - Collections and Search
Domino Views are different
In Domino data is typically accessed via a view, but views are different than the ones you know in an RDBMS. The following table should provide an rough overview.Item | RDBMS | Domino |
---|---|---|
Data | Defined in a database schema. Data is contained in tables. All records in a table are uniformly the same. Fields without values are there but empty. Different types of data require different tables. New data requires ALTER TABLE statements wich affects existing data (and often requires down time). Each column can have one value |
Data is contained in documents. Documents are schema free (there is a Meta Schema). Items in documents (the closest to a column in a table) can have multiple values. Each document can have a different set of items. New data is added as needed, no downtime or change of existing documents required |
Views | Selection of rows, often accompanied with a JOIN operation to denormalize normalized data. Can be all data of a table or a subset, picked by a WHERE part in the SELECT statement. By definition views don't contain any data, but pull them ad hoc from the participating tables. Various RDBMS systems use indexes on keys used in SQL statements to improve performance. The ad-hoc nature of the queries offers maximum flexibility at CPU and I/O cost. There is a whole industry around SQL Query Optimization (and there is the whole story about SQL Injection attacks even by mothers) |
|
Hierarchy | SQL Tables and views are flat by definition. Some SQL extensions (e.g. Oracle) allow hierarchical queries, but the result will be a flat query result. |
|
Sorting | Sorting happens using an ORDER BY clause. For resorting a new select clause needs to be issued. RDBMS systems allow indexes to be created to improve sorting speed. |
|
Definition | Views are defined in SQL using any editor of your choosing and then uploaded/executed in the database. Database admin rights are required | Views are defined in Domino Designer or even the standard Notes client. Users can be allowed to create "private" views only visible to themselves, or at access level Editor views that can be shared. Columns are defined by picking item names from a list, predefined functions or writing @Formula a LISP like language (easy to learn, quite powerful to use). Brave souls have been spotted using DXL to write view definitions in XML and upload them into designer (but you don't want to do that) |
Selection | View entries are selected by WHERE in SQL |
|
Performance killers | There is nothing better to make your hardware seller more happy than code that violates performance considerations. In SQL the typical performance killer are OUTER JOINS especially over many large tables. Missing indexes are another cause | Since Notes views contain actual data, they need to be treated a little different. There are a few killers around:
|
Next up: Finding data - Collections and Search
Posted by Stephan H Wissel on 26 December 2013 | Comments (0) | categories: IBM Notes XPages