Queries: The most common method to segment horizontally is through queries. You add a 'where' clause to the query to perform additional comparisons, selecting just those rows appropriate to the application or job function.
This is the preferred method, but if you must restrict access of the user who is writing the query, or are worried about Web applications that alter the query dynamically, adding a 'where' clause to the query is insufficient.
Views: A view is nothing more than a virtual copy of a table. This virtual table is defined by a query where we only retrieve a select number of columns and rows, thereby presenting the subset of data you want the user to see. You provide the user access to the view, but not to the underlying table. Views are in essence a mask, revealing some of the information but concealing the rest.
Table Partitioning: Partitioning is where you create one logical table, but disperse physical portions of the table across different databases/partitions. You direct the database to store data in different partitions based upon the key value of the record. For example, data may be keyed 'top secret' and stored in one location, and 'informational' data stored in another. Resetting privileges within each of the databases can shield data within the same table.
Labels. Labeling is a way to tag individual rows with some form of identifier that denotes how the data is handled. Rather than use a key field, a new column is added to the table and labels are applied to each row. Databases with native labeling technology will automatically screen rows from users who do not have access to specified tags. Labels are not available with all databases as a native function, but can be simulated manually adding columns and using views as discussed above.
These solutions are applicable in cases where rewriting or re-architecting the application is not possible, but finer-grained data access controls are needed. In all cases you are adding structure or altering a subset of queries, with each option requiring different management and code change burdens. Use only if access controls cannot provide what you need.
Adrian Lane is an analyst/CTO with Securosis LLC, an independent security consulting practice. Special to Dark Reading.