A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.
The following commonly owned, co-pending United States Patents and Patent Applications, including the present application, are related to each other. Each of the other patents/applications are incorporated by reference herein in its entirety:
U.S. patent application Ser. No. 10/669,523 entitled “QUERY OPTIMIZATION IN A MULTI-TENANT DATABASE SYSTEM,” by Craig Weissman et al., filed Sep. 23, 2003;
U.S. patent application Ser. No. 11/558,761 entitled “METHOD OF IMPROVING A QUERY TO A DATABASE SYSTEM,” by Craig Weissman et al., filed Nov. 11, 2006; and
U.S. patent application Ser. No. 10/817,161 entitled “CUSTOM ENTITIES AND FIELDS IN A MULTI-TENANT DATABASE SYSTEM,” by Craig Weissman et al., filed Apr. 2, 2004.
The current invention relates generally to controlling access to objects in a database, and more particularly to controlling access to custom objects in an on-demand database network system.
The subject matter discussed in the background section should not be assumed to be prior art merely as a result of its mention in the background section. Similarly, a problem mentioned in the background section or associated with the subject matter of the background section should not be assumed to have been previously recognized in the prior art. The subject matter in the background section merely represents different approaches, which in and of themselves may also be inventions.
In conventional database systems, users access their data resources in one logical database. A user of such a conventional system typically retrieves data from and stores data on the system using the user's own systems. A user system might remotely access one of a plurality of server systems that might in turn access the database system. Data retrieval from the system might include the issuance of a query from the user system to the database system. The database system might process the request for information received in the query and send to the user system information relevant to the request. The rapid and efficient retrieval of accurate information and subsequent delivery of this information to the user system in a transparent manner that is easy to understand is desirable.
Unfortunately, conventional database approaches might allow private data to be accessible to unauthorized persons if, for example, an unauthorized person is able to submit any query and to see all of the results of such a query. This can become particularly troublesome when an organization using a database, which is also used by other organizations, can freely define custom objects and the access rights to the custom objects.
Accordingly, it is desirable to provide techniques enabling the controlling of access to custom objects of the database system and/or optimizing a query to a custom object to improve performance and security of the database system.
In accordance with embodiments, there are provided mechanisms and methods for controlling access to custom objects. These mechanisms and methods for controlling access to custom objects can enable embodiments to utilize a key for the protection of the security of data that is to remain private while not compromising efficiency of a query. The key for a requested custom object is identified and then used so that only an appropriate portion of a custom entity share table is. searched to locate access information. It is then determined whether the user can access at least a portion of the custom object, and the appropriate and allowed data is sent to the user.
In an embodiment and by way of example, a method for controlling access to custom objects in a database is provided. The database stores data specific to each one of a plurality of tenants such that at least two of the tenants store at least a portion of data specific to the at least two tenants in a common table within the database. Each tenant is permitted access only to data associated with that tenant, where each tenant has one or more users.
A user associated with a first tenant receives a request to access data of a first custom object in the database. The common table includes at least two custom objects associated with the first tenant. The at least two custom objects each contain one or more data types specified by the first tenant. A key associated with the first custom object is identified. Only that portion of a custom entity share table appropriate to the key is searched to locate access information for the first custom object. Based at least in part on the access information, it is determined whether the user has permission to access at least a portion of the custom object. The requested data of the first custom object to which the user has permission to access is sent to the user.
Other embodiments of the invention are directed to systems and computer readable media associated with methods described herein, as well as methods for transmitting program code for creating the computer readable medium and/or for performing methods described herein.
While the present invention is described with reference to an embodiment in which techniques for controlling access to custom objects in an on-demand service environment are implemented in a system having an application server providing a front end for an on-demand database service capable of supporting multiple tenants, the present invention is not limited to multi-tenant databases nor deployment on application servers. Embodiments may be practiced using other database architectures, i.e., ORACLE®, DB2® by IBM and the like without departing from the scope of the embodiments claimed.
Any of the above embodiments may be used alone or together with one another in any combination. Inventions encompassed within this specification may also include embodiments that are only partially mentioned or alluded to or are not mentioned or alluded to at all in this brief summary or in the abstract. Although various embodiments of the invention may have been motivated by various deficiencies with the prior art, which may be discussed or alluded to in one or more places in the specification, the embodiments of the invention do not necessarily address any of these deficiencies. In other words, different embodiments of the invention may address different deficiencies that may be discussed in the specification. Some embodiments may only partially address some deficiencies or just one deficiency that may be discussed in the specification, and some embodiments may not address any of these deficiencies.
Reference to the remaining portions of the specification, including the drawings and claims, will realize other features and advantages of the present invention. Further features and advantages of the present invention, as well as the structure and operation of various embodiments of the present invention, are described in detail below with respect to the accompanying drawings.
In the following drawings, like reference numbers indicate identical or functionally similar elements. Although the following figures depict various examples of the invention, the invention is not limited to the examples depicted in the figures.
General Overview
Systems and methods are provided for controlling access to custom objects in a database system. These techniques for controlling access to custom objects can enable embodiments to utilize a key for the protection of the security of data that is to remain private while not compromising efficiency of a query.
As used herein, the term multi-tenant database system refers to those systems in which various elements of hardware and software of the database system may be shared by one or more customers. For example, a given application server may simultaneously process requests for a great number of customers, and a given database table may store rows for a potentially much greater number of customers. As used herein, the term query plan refers to a set of steps used to access information in a database system.
Next, mechanisms and methods for providing controlling access to custom objects in a database system will be described with reference to example embodiments.
System Overview
Environment 10 is an environment in which an on-demand database service exists. User system 12 may be any machine or system that is used by a user to access a database user system. For example, any of user systems 12 can be a handheld computing device, a mobile phone, a laptop computer, a work station, and/or a network of computing devices. As illustrated in
An on-demand database service, such as system 16, is a database system that is made available to outside users that do not need to necessarily be concerned with building and/or maintaining the database system, but instead may be available for their use when the users need the database system (e.g., on the demand of the users). Some on-demand database services may store information from one or more tenants stored into tables of a common database image to form a multi-tenant database system (MTS). Accordingly, “on-demand database service 16” and “system 16” will be used interchangeably herein. A database image may include one or more database objects. A relational database management system (RDMS) or the equivalent may execute storage and retrieval of information against the database object(s). Application platform 18 may be a framework that allows the applications of system 16 to run, such as the hardware and/or software, e.g., the operating system. In an embodiment, on-demand database service 16 may include an application platform 18 that enables creation, managing and executing one or more applications developed by the provider of the on-demand database service, users accessing the on-demand database service via user systems 12, or third party application developers accessing the on-demand database service via user systems 12.
The users of user systems 12 may differ in their respective capacities, and the capacity of a particular user system 12 might be entirely determined by permissions (permission levels) for the current user. For example, where a salesperson is using a particular user system 12 to interact with system 16, that user system has the capacities allotted to that salesperson. However, while an administrator is using that user system to interact with system 16, that user system has the capacities allotted to that administrator. In systems with a hierarchical role model, users at one permission level may have access to applications, data, and database information accessible by a lower permission level user, but may not have access to certain applications, database information, and data accessible by a user at a higher permission level. Thus, different users will have different capabilities with regard to accessing and modifying application and database information, depending on a user's security or permission level.
Network 14 is any network or combination of networks of devices that communicate with one another. For example, network 14 can be anyone or any combination of a LAN (local area network), WAN (wide area network), telephone network, wireless network, point-to-point network, star network, token ring network, hub network, or other appropriate configuration. As the most common type of computer network in current use is a TCP/IP (Transfer Control Protocol and Internet Protocol) network, such as the global internetwork of networks often referred to as the “Internet” with a capital “I,” that network will be used in many of the examples herein. However, it should be understood that the networks that the present invention might use are not so limited, although TCP/IP is a frequently implemented protocol.
User systems 12 might communicate with system 16 using TCPIIP and, at a higher network level, use other common Internet protocols to communicate, such as HTTP, FTP, AFS, WAP, etc. In an example where HTTP is used, user system 12 might include an HTTP client commonly referred to as a “browser” for sending and receiving HTTP messages to and from an HTTP server at system 16. Such an HTTP server might be implemented as the sole network interface between system 16 and network 14, but other techniques might be used as well or instead. In some implementations, the interface between system 16 and network 14 includes load sharing functionality, such as round-robin HTTP request distributors to balance loads and distribute incoming HTTP requests evenly over a plurality of servers. At least as for the users that are accessing that server, each of the plurality of servers has access to the MTS' data; however, other alternative configurations may be used instead.
In one embodiment, system 16, shown in
One arrangement for elements of system 16 is shown in
Several elements in the system shown in
According to one embodiment, each user system 12 and all of its components are operator configurable using applications, such as a browser, including computer code run using a central processing unit such as an Intel Pentium® processor or the like. Similarly, system 16 (and additional instances of an MTS, where more than one is present) and all of their components might be operator configurable using application(s) including computer code to run using a central processing unit such as processor system 17, which may include an Intel Pentium® processor or the like, and/or multiple processor units. A computer program product embodiment includes a machine-readable storage medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the embodiments described herein. Computer code for operating and configuring system 16 to intercommunicate and to process web pages, applications and other data and media content as described herein are preferably downloaded and stored on a hard disk, but the entire program code, or portions thereof, may also be stored in any other volatile or non-volatile memory medium or device as is well known, such as a ROM or RAM, or provided on any media capable of storing program code, such as any type of rotating media including floppy disks, optical discs, digital versatile disk (DVD), compact disk (CD), microdrive, and magneto-optical disks, and magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data. Additionally, the entire program code, or portions thereof, may be transmitted and downloaded from a software source over a transmission medium, e.g., over the Internet, or from another server, as is well known, or transmitted over any other conventional network connection as is well known (e.g., extranet, VPN, LAN, etc.) using any communication medium and protocols (e.g., TCPIIP, HTTP, HTTPS, Ethernet, etc.) as are well known. It will also be appreciated that computer code for implementing embodiments of the present invention can be implemented in any programming language that can be executed on a client system and/or server or server system such as, for example, C, C++, HTML, any other markup language, Java™, JavaScript, ActiveX, any other scripting language, such as VBScript, and many other programming languages as are well known may be used. (Java™ is a trademark of Sun Microsystems, Inc.).
According to one embodiment, each system 16 is configured to provide web pages, forms, applications, data and media content to user (client) systems 12 to support the access by user systems 12 as tenants of system 16. As such, system 16 provides security mechanisms to keep each tenant's data separate unless the data is shared. If more than one MTS is used, they may be located in close proximity to one another (e.g., in a server farm located in a single building or campus), or they may be distributed at locations remote from one another (e.g., one or more servers located in city A and one or more servers located in city B). As used herein, each MTS could include one or more logically and/or physically connected servers distributed locally or across one or more geographic locations. Additionally, the term “server” is meant to include a computer system, including processing hardware and process space(s), and an associated storage system and database application (e.g., OODBMS or RDBMS) as is well known in the art. It should also be understood that “server system” and “server” are often used interchangeably herein. Similarly, the database object described herein can be implemented as single databases, a distributed database, a collection of distributed databases, a database with redundant online or offline backups or other redundancies, etc., and might include a distributed database or storage network and associated processing intelligence.
User system 12, network 14, system 16, tenant data storage 22, and system data storage 24 were discussed above in
Application platform 18 includes an application setup mechanism 38 that supports application developers' creation and management of applications, which may be saved as metadata into tenant data storage 22 by save routines 36 for execution by subscribers as one or more tenant process spaces 104 managed by tenant management process 110 for example. Invocations to such applications may be coded using PL/SOQL 34 that provides a programming language style interface extension to API 32. A detailed description of some PL/SOQL language embodiments is discussed in commonly owned co-pending U.S. Provisional Patent Application 60/828,192 entitled, PROGRAMMING LANGUAGE METHOD AND SYSTEM FOR EXTENDING APIS TO EXECUTE IN CONJUNCTION WITH DATABASE APIS, by Craig Weissman, filed Oct. 4, 2006, which is incorporated in its entirety herein for all purposes. Invocations to applications may be detected by one or more system processes, which manages retrieving application metadata 116 for the subscriber making the invocation and executing the metadata as an application in a virtual machine.
Each application server 100 may be communicably coupled to database systems, e.g., having access to system data 25 and tenant data 23, via a different network connection. For example, one application server 1001 might be coupled via the network 14 (e.g., the Internet), another application server 100N-1 might be coupled via a direct network link, and another application server 100N might be coupled by yet a different network connection. Transfer Control Protocol and Internet Protocol (TCPIIP) are typical protocols for communicating between application servers 100 and the database system. However, it will be apparent to one skilled in the art that other transport protocols may be used to optimize the system depending on the network interconnect used.
In certain embodiments, each application server 100 is configured to handle requests for any user associated with any organization that is a tenant. Because it is desirable to be able to add and remove application servers from the server pool at any time for any reason, there is preferably no server affinity for a user and/or organization to a specific application server 100. In one embodiment, therefore, an interface system implementing a load balancing function (e.g., an F5 Big-IP load balancer) is communicably coupled between the application servers 100 and the user systems 12 to distribute requests to the application servers 100. In one embodiment, the load balancer uses a least connections algorithm to route user requests to the application servers 100. Other examples of load balancing algorithms, such as round robin and observed response time, also can be used. For example, in certain embodiments, three consecutive requests from the same user could hit three different application servers 100, and three requests from different users could hit the same application server 100. In this manner, system 16 is multi-tenant, wherein system 16 handles storage of, and access to, different objects, data and applications across disparate users and organizations.
As an example of storage, one tenant might be a company that employs a sales force where each salesperson uses system 16 to manage their sales process. Thus, a user might maintain contact data, leads data, customer follow-up data, performance data, goals and progress data, etc., all applicable to that user's personal sales process (e.g., in tenant data storage 22). In an example of a MTS arrangement, since all of the data and the applications to access, view, modify, report, transmit, calculate, etc., can be maintained and accessed by a user system having nothing more than network access, the user can manage his or her sales efforts and cycles from any of many different user systems. For example, if a salesperson is visiting a customer and the customer has Internet access in their lobby, the salesperson can obtain critical updates as to that customer while waiting for the customer to arrive in the lobby.
While each user's data might be separate from other users' data regardless of the employers of each user, some data might be organization-wide data shared or accessible by a plurality of users or all of the users for a given organization that is a tenant. Thus, there might be some data structures managed by system 16 that are allocated at the tenant level while other data structures might be managed at the user level. Because an MTS might support multiple tenants including possible competitors, the MTS should have security protocols that keep data, applications, and application use separate. Also, because many tenants may opt for access to an MTS rather than maintain their own system, redundancy, up-time, and backup are additional functions that may be implemented in the MTS. In addition to user-specific data and tenant-specific data, system 16 might also maintain system level data usable by multiple tenants or other data. Such system level data might include industry reports, news, postings, and the like that are sharable among tenants.
In certain embodiments, user systems 12 (which may be client systems) communicate with application servers 100 to request and update system-level and tenant level data from system 16 that may require sending one or more queries to tenant data storage 22 and/or system data storage 24. System 16 (e.g., an application server 100 in system 16) automatically generates one or more SQL statements (e.g., one or more SQL queries) that are designed to access the desired information. System data storage 24 may generate query plans to access the requested data from the database.
Each database can generally be viewed as a collection of objects, such as a set of logical tables, containing data fitted into predefined categories. A “table” is one representation of a data object, and may be used herein to simplify the conceptual description of objects and custom objects according to the present invention. It should be understood that “table” and “object” may be used interchangeably herein. Each table generally contains one or more data categories logically arranged as columns or fields in a viewable schema. Each row or record of a table contains an instance of data for each category defined by the fields. For example, a CRM database may include a table that describes a customer with fields for basic contact information such as name, address, phone number, fax number, etc. Another table might describe a purchase order, including fields for information such as customer, product, sale price, date, etc. In some multi-tenant database systems, standard entity tables might be provided for use by all tenants. For CRM database applications, such standard entities might include tables for Account, Contact, Lead, and Opportunity data, each containing pre-defined fields. It should be understood that the word “entity” may also be used interchangeably herein with “object” and “table”.
The org id column 201 is provided to distinguish among organizations using the multi-tenant account table 200. As shown, N different organizations have data stored in table 200. The org ids in column 201 are defined as Char(15) in an example implementation, but may include other data types. In one aspect, the first 3 characters of the org id is set to a predefined prefix, such as “00d”, although another subset of characters in the org id may be used to hold such a prefix if desired.
Custom Objects
An organization using the standard entities provided by the system may desire that one or more new entities be created to specifically cater to, and to facilitate data storage and retrieval for, that organization's particular business model. Accordingly, in some multi-tenant database systems, tenants may be allowed to create and store custom objects. U.S. Patent application Ser. No. 10/817,161, filed Apr. 2, 2004, entitled “Custom Entities and Fields in a Multi-Tenant Database System”, and which is hereby incorporated herein by reference, teaches systems and methods for creating custom objects as well as customizing standard objects in a multi-tenant database system. In certain embodiments, for example, all custom entity data rows are stored in a single multi-tenant physical table, which may contain multiple logical tables per organization. It is transparent to customers that their multiple “tables” are in fact stored in one large table or that their data may be stored in the same table as the data of other customers.
The org id column is used to distinguish among the various organizations populating table 400. For example, multiple organizations may create custom entities, all of which are stored to table 400 in one aspect. Custom entity id column 402 is used to distinguish among the various custom entity tables stored in table 400. Custom entity id column 402 also acts as the primary key column for table 400. Custom field columns 403 are used to store the data for the various custom entities defined by the various organizations. Specifically, custom field columns 403 store the columns defined for each of the various custom entities defined by the various organizations populating table 400.
According to one embodiment, the first 3 characters of the globally unique primary key field 402 are used to identify the specific entity type. This technique advantageously allows for multiple custom entity types for one organization to be distinguished in this one custom entity table 400 as will be discussed below. It will be appreciated, however, that fewer or more than the first 3 characters of the primary key may be used to identify entities, or that any subcombination of characters of the primary key may be used.
When an organization administrator defines a new custom entity, the definition is stored in the metadata instead of the underlying data dictionary.
Referring to
When creating a custom entity table, the administrator for an organization specifies a unique (within the organization) developer name for the custom entity—this is the name used to identify that particular entity for API calls and other developer entry points into the system. This name is stored in the entity name column 530 of table 500. Custom fields may also be defined for custom entities, and where desired, custom fields may be flagged for indexing, as described above. Once custom fields are defined for the custom entity, the organization can begin to use that custom entity like any other standard entity. For example, all API operations (e.g., describe, insert, update, delete, query, search) are available and the organization may define a user interface for editing that custom entity in an online application. Transparent to the users and organization, however, the custom entity table is stored in a single custom entity table 400 along with other custom entity tables defined by that organization as well as other organizations.
One difference in terms of SQL when operating on a custom entity table is the need to filter on the custom entity id in addition to the organization id to ensure that the data from multiple logical entity types within one organization are not mixed together. For example, the leading 3-character portion of the primary key index (e.g., a01 . . . aMN) can be used for this efficient filtering. Thus, filtering on the organization id and the 3-character prefix provides a determination of a specific entity type for the organization. Similarly, an insert PL/SQL call should be told which 3-character prefix to use when inserting a new primary key value and custom entity row. For the sake of simplicity, row partitions are not shown in table 400, however organization partitions 450 and entity partitions 460 are shown.
Even after a custom object has been identified and filtered, it may be advantageous to identify the access rights associated with the of the custom object.
Controlling Access to Custom Objects
A user associated with a first tenant may not have access rights to view certain objects or specific entries (such as rows) of an object, as well as the objects of another tenant. For example, a user may have access rights to a custom object 470, but not have access rights to a custom object 480. If it is known which objects or rows of objects that a user can see, then optimizations may be made to return the result of a query by that user much more efficiently, while still ensuring that unauthorized users cannot see certain data.
Regarding access rights, a private sharing feature or rules may allow groups defined within a particular tenant{s) to share information only among members of that group provided in certain embodiments. Sharing rules are a way of granting access to a set of entities (the source), to a set of users (the target). In one aspect, the source set is a logical set of entities defined by picking a group. The source then contains all entities owned or with access rights by users in the group. In one aspect, sharing rules also specify an access level for each entity.
In one embodiment, access relationships calculated (from sharing rules or implicit relationships) or explicitly defined are persisted in records for efficiency. These records, e.g. custom share table 600 and related tables, may contain the entity, the user or groups it's shared to, an access level and a cause to track the origin of the record.
This private sharing feature allows a specific list of users to have access to privileged data, for example, such as specific accounts or opportunities. It is noteworthy that not all tenants will elect to enable private sharing for their implementations. Some tenants will elect public sharing paradigm instead. In a public sharing implementation, each user associated with a tenant sees every data row within the tenant's organization. Sharing tables, such as the custom entity share table, e.g. 600 of
Custom entity share table 600 of
Groups are a convenient way to specify a set of users. Groups can be explicitly specified or implicitly created. These groups can be hierarchical, that is, user groups (child groups) can be a member of another group (parent group). The set of users in a group is the all the users in the group and its child groups. In one embodiment, this information is maintained in the blowout table 675 for efficiency. The blowout table 675 may also include one or more columns or group entries in the user id column for child groups. Blowout table 675 or a similar table can contain other user-to-user relationships, such as the hierarchal relationships of table 675. In one embodiment, group membership is maintained in table 625 in order to evaluate entity access for users and groups with the same database query.
The table 600 also has a column for the key prefix 540, for each custom entity of organization #1. Thus, in one embodiment, custom entities share a single rule table partitioned by their key. The first custom object is identified with “a01” and the second custom object with “a02.” The user group ID column shows which groups have access to a particular custom object. The user group ID column can also name specific users.
In the embodiment shown, only one group has access to each of the custom objects. In other embodiments, the User Group ID may contain multiple entries, i.e. multiple groups may have access to a certain custom object.
In one embodiment, the existence of a user group ID in table 600 signifies that a group can see all of the rows of an associated custom object. For example, the “Engineering” group can see all of the rows of the custom object “a01”. In another embodiment, the existence of a user group ID in table 600 means that the group can see at least one row, but not necessarily all of the rows of the custom object. Table 600 may also contain access information for each row of a custom entity or this may be available in another table specific to that custom entity.
Access relationship data may be created synchronously with updates to the dependent data (group membership, sharing rules or updates to the entity) or can be deferred for later depending on processing time. Any information intended for the access relationship table deemed to be trivial because of clients default settings for their organizations need not be maintained for efficiency.
In addition to the standard sharing rules, in one aspect custom entities are defined to have master/detail relationships with other (standard and custom) entities. Child custom entities in this relationship do not have an owner. Instead, child entities dynamically inherit sharing access from that defined on their parent entity. If however, the child is detached from its parent, it becomes a standalone entity with its own owner and sharing access.
Thus, in one embodiment, table 400 is a database common table that stores data of multiple tenants, where each tenant is permitted access only to data associated with that tenant (e.g. data that has the same org id as the tenant). In another embodiment, the common table may be a mixed standard and custom entity table. The mixed table would be able to accommodate standard entities as well as custom entities.
In step 720, a key associated with the first custom object is identified. In one embodiment, the key is identified by searching the custom entity definition table 500 to identify the key prefix 540 that corresponds to the custom object. In another embodiment, the request contains the key, and thus the key would be identified in the request itself.
In step 730, only that portion of a custom entity share table (e.g. table 600) appropriate to the key is searched to locate information useful to determine if the user is permitted to access the first custom object. In one embodiment, the information includes the user group or users that are identified in the User group ID column of table 600 as having access rights to the custom object with the identified key. In one aspect, the custom entity share table includes access information for each custom object of the first tenant.
In one embodiment, the information may be obtained by starting a search in the custom entity share table from the left using a filter on the key prefix. In another embodiment, the search may be started form the right using a filter on the user an/or groups that the user belongs, or users below the requesting user. This may be done, for example, if there are requested data for many custom entities contained within the user's request.
In step 740, it is determined whether the user can access at least a portion of the custom object based on the useful information. A user may have access rights to all of the rows of a custom object or it may only have access to some of the rows. Additional information may be obtained to make this determination, along with a query plan to make the determination.
In step 750, the requested data of the first custom object to which the user can access is sent to the user. The requested data may be the result of a query with filter predicates that provide a selection of the data desired. The efficiency of the query can be benefited with additional access rights information, which may be statistical in nature.
Optimizing Query of Custom Objects
A query may be optimized using the access rights information as follows. When displaying a list of all rows that the current user can see (possibly with a filter on the entity rows, such as the name of the account or the dollar amount of the opportunity) the query optimizer will choose between accessing the custom entity share table 600 from the user side (i.e., Engineering or Bridge) or the entity side (i.e., “oodl” and/or “a01”) of the relationship.
If an entity filter is highly selective (for instance, a particular asset name such as “XYZ Corp”) it will generally be more likely to provide a more efficient query by beginning the query access path from the custom object side. If, however, the entity is not filtered selectively, but a current user has access to a small amount of data, then the query optimizer should access rows in the share table 600 through the user side. Because, in the above example, a conventional database system optimizer's native statistic methods may be insufficient to make this determination, since the native statistics will aggregate across multiple tenants and will not provide context into the current tenant's data, embodiments implementing private sharing provide mechanisms and methods for improving the original query prior to the query being submitted to the database.
It is noteworthy that, because of the wide range of business types, industries, and sizes potentially served by multi-tenant database systems, the likelihood of data “skew” is greatly increased. That is, the statistical profile of the largest most complex tenants is likely to look very different from that of small or medium sized customers. The use of query “Hints” enable the ability to choose explicitly an improved query plan.
For instance, an improved SQL statement might mention the explicit order of table joins, or explicit index names to use (rather than letting the optimizer choose automatically). Another mechanism for controlling the query plan explicitly is to re-write the query using equivalent but different SQL syntax. For instance, a single flat SQL statement can be re-S written using a nested SELECT in the FROM clause of the outer query. Joins and semi-joins are sometimes inter-changeable. Anti joins can be written using the MINUS operator, etc. All of these are examples of ways in which a programmatic SQL generator can alter the behavior of the query optimizer native to an underlying database by using contextual knowledge to change the query plan.
In certain aspects, a query optimizer native to a RDBMS, may be configured or “tuned” by supplying appropriate “hints” to the native query optimizer. For example, when SQL is generated programmatically by the MTS, the tenant-level statistics are consulted and a dynamic decision is made as to the syntax of the query. As used herein the term tenant level statistics is broadly defined as statistical quantities that, though they may mirror the underlying relational database statistics in many ways (for example, in one aspect they track the total number of distinct values for indexed columns), are kept on a per-tenant basis. In one embodiment, tenant level statistics may be stored in tables in tenant database storage areas 112. Similarly for important application functionality, such as the sharing feature, the MTS tracks the approximate number of rows to which each user has access and stores such statistics (e.g., tables stored in user storage areas 114 of database 108). Then, when a filtered sharing query arrives, the dynamically generated SQL includes the appropriate hints and structure to force a query plan that is improved.
In one aspect, metadata information about users and tenants/organizations and the data contained in entity rows for that tenant are tracked (e.g., relevant information and metadata stored to separate user-level and tenant-level data tables) in order to make choices about query access paths. In an embodiment, evaluation of a sharing model controls which users can see which records. These embodiments can distinguish between users that can see many rows in an organization (e.g., bosses) versus users who can see very few rows (e.g., lower level employees).
The use of the key prefix can substantially increase the efficiency of making this determination. In a further embodiment, the joining and tracking of specialized tables is made more efficient by using tenant-level statistics. In a yet further embodiment, a sharing model is combined with a proper choice of filters, e.g. which model or filter should lead the query and how should the other filters be organized in a query plan in order to improve the efficiency of the query.
Improving The Search On Rows
In embodiments, for each user in the system, an approximate count of the number of rows that the user can see is tracked for each entity type or organization that has a sharing model. This number of rows (as a percentage of the total number of entity rows for that organization) is used as a decision point by embodiments selecting between two different query paths. It has been determined empirically that users who can see most of the entity rows (e.g., bosses) benefit from a certain query structure, whereas users who can see a small percentage of the entity rows (e.g., lower level employees) benefit from a different query structure. Conventional approaches are not able to select between the two query paths without having an entirely different SQL provided via a programmatic decision.
In aspects, a query improver reads data from multi-tenant data tables and stores metadata (e.g., number of rows accessible per tenant or per user, or other metadata) to tenant level tables or user-level tables in database 108. For example, a tenant-level metadata table might be stored to a tenant storage area 112 and a user-level table might be stored to a user storage area 114. In one aspect, the query improver includes a metadata generator that processes multi-tenant tables and produces tenant-level and user-level metadata tables, such as the tenant level metadata table 650 shown by
The number of rows that are accessible by a tenant or user may be calculated based on the ownership of a row, which is tracked in column 209 of table 200. The ownership information can be entered when the row (e.g. account) is created or by other means and/or at other times depending upon implementation specific details. From this ownership data, metadata tables may be permanently created or calculated dynamically upon login of a user. Using such metadata, a user query may be improved prior to submission to an underlying database manager. If a user can see few rows, then a query may be improved by structuring the query to retrieve all of the data in those rows and then apply any desired filters to the data in the selected rows. For example, consider a query of the form: “Show me all accounts that I can see” in a private account sharing model. An example of a data model for sharing appears in
Conversely for a “boss” user who can see most of the entity records in the organization, the query improver will select another way to access the data, e.g. by applying a selective filter on all rows of the desired tenant. If the metadata gathered for a boss (done by gathering up the ownership numbers for people beneath) indicates access to many rows, it is typically most advantageous to begin the query from the left and use a nested loop query plan onto the sharing table (acc_share), an example of which follows:
Note that this query in general runs in relatively constant (reasonable) time for all users in an organization. It may not be particularly fast since it must look at all top-level entity records, but it is suitable for a boss who can in fact see most records. The first “lower 1 0 level employee” query runs much faster for users who in fact can not see many records, but it may run much slower for bosses who can see all records. This, again, is why it is desirable to have an accurate decision between the two paths.
In order to keep the metadata current, the percentage of rows that each and every user can see can be tracked. In one aspect, there are three ways in which a user might gain 15 access to data in a private security model:
In one aspect, the total number of rows for each entity type for each organization is tracked (this is useful for any of the strategies above). Also, the total number of rows owned by each user in a metadata table is tracked.
Because (1) and (2) can be important reasons for tracking why a user has access to entity records in some implementations, (this might be known empirically from how organizations use the system) the information needed to calculate the number of rows a user can see, at least approximately, can be determined from the role hierarchy metadata table 675 of
The sharing rule metadata, such as tables 600 or 650, can also be used along with the group definition metadata, such as table 625, to calculate the total number of rows visible for a given user via sharing rules. For example, tables 600 and 625 may be joined from the right so that all of the groups to which a user belongs is determined. The number of rows seen by each of these groups may then be obtained from table 650 and added together. Table 650 may be calculated from table 600 for each organization. It will be appreciated by those skilled in the art that, while these methods of determining users from metadata tables illustrated by
It is also noteworthy that, for the purpose of the heuristic decision between “boss” and “lower level employee,” the sum of these two values is sufficiently close to the true value even though these two sets may overlap.
In one aspect, the use of metadata tables such as the metadata tables illustrated by
Besides user group ID, Table 650 could have a tenant, division, group or other type of identification. Thus, each one of the tables in an example embodiment illustrated by
It should be understood that the present invention as described above can be implemented in the form of control logic using computer software in a modular or integrated manner. Based on the disclosure and teachings provided herein, a person of ordinary skill in the art will know and appreciate other ways and/or methods to implement the present invention using hardware and a combination of hardware and software
Any of the software components or functions described in this application, may be implemented as software code to be executed by a processor using any suitable computer language such as, for example, Java, C++ or Perl using, for example, conventional or object-oriented techniques. Computer programs incorporating features of the present invention may be encoded on various computer readable media for storage and/or transmission; suitable media include magnetic disk or tape, optical storage media such as compact disk (CD) or DVD (digital versatile disk), flash memory, and the like. The computer readable medium may be any combination of such storage or transmission devices. Thus, embodiments also provide methods of transmitting program code to one or more processors for implementing any of the methods mention herein.
Such programs may also be encoded and transmitted using carrier signals adapted for transmission via wired, optical, and/or wireless networks conforming to a variety of protocols, including the Internet. As such, a computer readable medium according to an embodiment of the present invention may be created using a carrier signal carrying such programs. Computer readable media encoded with the program code may be packaged with a compatible device or provided separately from other devices (e.g., via Internet download). Any such computer readable medium may reside on or within a single computer program product (e.g. a hard drive or an entire computer system), and may be present on or within different computer program products within a system or network.
While the invention has been described by way of example and in terms of the specific embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. To the contrary, it is intended to cover various modifications and similar arrangements as would be apparent to those skilled in the art. Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
This application is a continuation of U.S. patent application Ser. No. 13/346,622 , entitled “METHODS AND SYSTEMS FOR CONTROLLING ACCESS TO CUSTOM OBJECTS IN A DATABASE,” by Craig Weissman et al., filed 9 Jan. 2012, which issued as U.S. Pat. No. 8,548,982 on 1 Oct. 2013, which is a continuation of U.S. patent application Ser. No. 11/866,184, entitled “METHODS AND SYSTEMS FOR CONTROLLING ACCESS TO CUSTOM OBJECTS IN A DATABASE,” by Craig Weissman et al., filed 2 Oct. 2007, which issued as U.S. Pat. No. 8,095,531 on 10 Jan. 2012, which claims the benefit of U.S. Provisional Patent Application No. 60/828,019 entitled “METHODS AND SYSTEMS FOR CONTROLLING ACCESS TO CUSTOM OBJECTS IN A DATABASE,” by Craig Weissman et al., filed 3 Oct. 2006. The priority applications are incorporated herein by reference.
Number | Name | Date | Kind |
---|---|---|---|
5544355 | Chaudhuri et al. | Aug 1996 | A |
5577188 | Zhu | Nov 1996 | A |
5584224 | Davies et al. | Dec 1996 | A |
5608872 | Schwartz et al. | Mar 1997 | A |
5649104 | Carleton et al. | Jul 1997 | A |
5701453 | Maloney et al. | Dec 1997 | A |
5715450 | Ambrose et al. | Feb 1998 | A |
5751949 | Thomson et al. | May 1998 | A |
5761419 | Schwartz et al. | Jun 1998 | A |
5819038 | Carleton et al. | Oct 1998 | A |
5821937 | Tonelli et al. | Oct 1998 | A |
5831610 | Tonelli et al. | Nov 1998 | A |
5873096 | Lim et al. | Feb 1999 | A |
5893077 | Griffin | Apr 1999 | A |
5918159 | Fomukong et al. | Jun 1999 | A |
5918224 | Bredenberg | Jun 1999 | A |
5937401 | Hillegas | Aug 1999 | A |
5937402 | Pandit | Aug 1999 | A |
5940818 | Malloy et al. | Aug 1999 | A |
5963953 | Cram et al. | Oct 1999 | A |
5991754 | Raitto et al. | Nov 1999 | A |
6092062 | Lohman et al. | Jul 2000 | A |
6092083 | Brodersen et al. | Jul 2000 | A |
6134540 | Carey et al. | Oct 2000 | A |
6161149 | Achacoso et al. | Dec 2000 | A |
6169534 | Raffel et al. | Jan 2001 | B1 |
6169993 | Shutt et al. | Jan 2001 | B1 |
6178425 | Brodersen et al. | Jan 2001 | B1 |
6189011 | Lim et al. | Feb 2001 | B1 |
6216135 | Brodersen et al. | Apr 2001 | B1 |
6233617 | Rothwein et al. | May 2001 | B1 |
6236996 | Bapat et al. | May 2001 | B1 |
6266669 | Brodersen et al. | Jul 2001 | B1 |
6275824 | O'Flaherty et al. | Aug 2001 | B1 |
6275825 | Kobayashi et al. | Aug 2001 | B1 |
6295530 | Ritchie et al. | Sep 2001 | B1 |
6324568 | Diec | Nov 2001 | B1 |
6324693 | Brodersen et al. | Nov 2001 | B1 |
6336137 | Lee et al. | Jan 2002 | B1 |
D454139 | Feldcamp | Mar 2002 | S |
6363371 | Chaudhuri et al. | Mar 2002 | B1 |
6367077 | Brodersen et al. | Apr 2002 | B1 |
6393605 | Loomans | May 2002 | B1 |
6405209 | Obendorf | Jun 2002 | B2 |
6405220 | Brodersen et al. | Jun 2002 | B1 |
6434550 | Warner et al. | Aug 2002 | B1 |
6446089 | Brodersen et al. | Sep 2002 | B1 |
6529901 | Chaudhuri et al. | Mar 2003 | B1 |
6535909 | Rust | Mar 2003 | B1 |
6549908 | Loomans | Apr 2003 | B1 |
6550057 | Bowman-Amuah | Apr 2003 | B1 |
6553563 | Ambrose et al. | Apr 2003 | B2 |
6560461 | Fomukong et al. | May 2003 | B1 |
6574635 | Stauber et al. | Jun 2003 | B2 |
6577726 | Huang et al. | Jun 2003 | B1 |
6587854 | Guthrie et al. | Jul 2003 | B1 |
6601087 | Zhu et al. | Jul 2003 | B1 |
6604117 | Lim et al. | Aug 2003 | B2 |
6604128 | Diec | Aug 2003 | B2 |
6609150 | Lee et al. | Aug 2003 | B2 |
6621834 | Scherpbier et al. | Sep 2003 | B1 |
6654032 | Zhu et al. | Nov 2003 | B1 |
6665648 | Brodersen et al. | Dec 2003 | B2 |
6665655 | Warner et al. | Dec 2003 | B1 |
6684438 | Brodersen et al. | Feb 2004 | B2 |
6711565 | Subramaniam et al. | Mar 2004 | B1 |
6724399 | Katchour et al. | Apr 2004 | B1 |
6728702 | Subramaniam et al. | Apr 2004 | B1 |
6728960 | Loomans | Apr 2004 | B1 |
6732095 | Warshavsky et al. | May 2004 | B1 |
6732100 | Brodersen et al. | May 2004 | B1 |
6732111 | Brodersen et al. | May 2004 | B2 |
6754681 | Brodersen et al. | Jun 2004 | B2 |
6757805 | Wu | Jun 2004 | B2 |
6763351 | Subramaniam et al. | Jul 2004 | B1 |
6763501 | Zhu et al. | Jul 2004 | B1 |
6768904 | Kim | Jul 2004 | B2 |
6772229 | Achacoso et al. | Aug 2004 | B1 |
6782383 | Subramaniam et al. | Aug 2004 | B2 |
6804330 | Jones et al. | Oct 2004 | B1 |
6823384 | Wilson et al. | Nov 2004 | B1 |
6826565 | Ritchie et al. | Nov 2004 | B2 |
6826582 | Chatterjee et al. | Nov 2004 | B1 |
6826745 | Coker et al. | Nov 2004 | B2 |
6829655 | Huang et al. | Dec 2004 | B1 |
6842748 | Warner et al. | Jan 2005 | B1 |
6850895 | Brodersen et al. | Feb 2005 | B2 |
6850949 | Warner et al. | Feb 2005 | B2 |
6988109 | Stanley et al. | Jan 2006 | B2 |
7062502 | Kesler | Jun 2006 | B1 |
7069231 | Cinarkaya et al. | Jun 2006 | B1 |
7069497 | Desai | Jun 2006 | B1 |
7096216 | Anonsen | Aug 2006 | B2 |
7127461 | Zhu et al. | Oct 2006 | B1 |
7171413 | Puz et al. | Jan 2007 | B2 |
7181758 | Chan | Feb 2007 | B1 |
7216125 | Goodwin | May 2007 | B2 |
7289976 | Kihneman et al. | Oct 2007 | B2 |
7340411 | Cook | Mar 2008 | B2 |
7346617 | Wong | Mar 2008 | B2 |
7356482 | Frankland et al. | Apr 2008 | B2 |
7401094 | Kesler | Jul 2008 | B1 |
7412455 | Dillon | Aug 2008 | B2 |
7508789 | Chan | Mar 2009 | B2 |
7529728 | Weissman et al. | May 2009 | B2 |
7603483 | Psounis et al. | Oct 2009 | B2 |
7620655 | Larsson et al. | Nov 2009 | B2 |
7698160 | Beaven et al. | Apr 2010 | B2 |
7779039 | Weissman et al. | Aug 2010 | B2 |
7779475 | Jakobson et al. | Aug 2010 | B2 |
7851004 | Hirao et al. | Dec 2010 | B2 |
8014943 | Jakobson | Sep 2011 | B2 |
8015211 | Marceau et al. | Sep 2011 | B2 |
8015495 | Achacoso et al. | Sep 2011 | B2 |
8032297 | Jakobson | Oct 2011 | B2 |
8073850 | Hubbard et al. | Dec 2011 | B1 |
8078597 | Polk et al. | Dec 2011 | B2 |
8082301 | Ahlgren et al. | Dec 2011 | B2 |
8095413 | Beaven | Jan 2012 | B1 |
8095594 | Beaven et al. | Jan 2012 | B2 |
8112459 | Dettinger et al. | Feb 2012 | B2 |
8209308 | Rueben et al. | Jun 2012 | B2 |
8209333 | Hubbard et al. | Jun 2012 | B2 |
8275836 | Beaven et al. | Sep 2012 | B2 |
8457545 | Chan | Jun 2013 | B2 |
8484111 | Frankland et al. | Jul 2013 | B2 |
8490025 | Jakobson et al. | Jul 2013 | B2 |
8504945 | Jakobson et al. | Aug 2013 | B2 |
8510045 | Rueben et al. | Aug 2013 | B2 |
8510664 | Rueben et al. | Aug 2013 | B2 |
8543566 | Weissman et al. | Sep 2013 | B2 |
8566301 | Rueben et al. | Oct 2013 | B2 |
8646103 | Jakobson et al. | Feb 2014 | B2 |
8756275 | Jakobson | Jun 2014 | B2 |
8769004 | Jakobson | Jul 2014 | B2 |
8769017 | Jakobson | Jul 2014 | B2 |
20010044791 | Richter et al. | Nov 2001 | A1 |
20020052862 | Scott et al. | May 2002 | A1 |
20020072951 | Lee et al. | Jun 2002 | A1 |
20020082892 | Raffel et al. | Jun 2002 | A1 |
20020129352 | Brodersen et al. | Sep 2002 | A1 |
20020140731 | Subramaniam et al. | Oct 2002 | A1 |
20020143997 | Huang et al. | Oct 2002 | A1 |
20020156756 | Stanley et al. | Oct 2002 | A1 |
20020162090 | Parnell et al. | Oct 2002 | A1 |
20020165742 | Robins | Nov 2002 | A1 |
20030004971 | Gong et al. | Jan 2003 | A1 |
20030009446 | Agarwal et al. | Jan 2003 | A1 |
20030014394 | Fujiwara et al. | Jan 2003 | A1 |
20030018705 | Chen et al. | Jan 2003 | A1 |
20030018830 | Chen et al. | Jan 2003 | A1 |
20030065648 | Driesch et al. | Apr 2003 | A1 |
20030066031 | Laane | Apr 2003 | A1 |
20030066032 | Ramachandran et al. | Apr 2003 | A1 |
20030069902 | Narang et al. | Apr 2003 | A1 |
20030069936 | Warner et al. | Apr 2003 | A1 |
20030070000 | Coker et al. | Apr 2003 | A1 |
20030070004 | Mukundan et al. | Apr 2003 | A1 |
20030070005 | Mukundan et al. | Apr 2003 | A1 |
20030074418 | Coker | Apr 2003 | A1 |
20030120675 | Stauber et al. | Jun 2003 | A1 |
20030151633 | George et al. | Aug 2003 | A1 |
20030154197 | Millet et al. | Aug 2003 | A1 |
20030159136 | Huang et al. | Aug 2003 | A1 |
20030187921 | Diec | Oct 2003 | A1 |
20030189600 | Gune et al. | Oct 2003 | A1 |
20030204427 | Gune et al. | Oct 2003 | A1 |
20030206192 | Chen et al. | Nov 2003 | A1 |
20030225730 | Warner et al. | Dec 2003 | A1 |
20040001092 | Rothwein et al. | Jan 2004 | A1 |
20040010489 | Rio | Jan 2004 | A1 |
20040015981 | Coker et al. | Jan 2004 | A1 |
20040019587 | Fuh et al. | Jan 2004 | A1 |
20040027388 | Berg et al. | Feb 2004 | A1 |
20040128001 | Levin et al. | Jul 2004 | A1 |
20040186860 | Lee et al. | Sep 2004 | A1 |
20040193510 | Catahan et al. | Sep 2004 | A1 |
20040199489 | Barnes-Leon et al. | Oct 2004 | A1 |
20040199536 | Barnes Leon et al. | Oct 2004 | A1 |
20040199543 | Braud et al. | Oct 2004 | A1 |
20040249854 | Barnes-Leon et al. | Dec 2004 | A1 |
20040260534 | Pak et al. | Dec 2004 | A1 |
20040260659 | Chan et al. | Dec 2004 | A1 |
20040268299 | Lei et al. | Dec 2004 | A1 |
20050044426 | Vogel et al. | Feb 2005 | A1 |
20050050041 | Galindo-Legaria et al. | Mar 2005 | A1 |
20050050046 | Puz et al. | Mar 2005 | A1 |
20050050555 | Exley et al. | Mar 2005 | A1 |
20050065925 | Weissman et al. | Mar 2005 | A1 |
20050071345 | Lin | Mar 2005 | A1 |
20050091098 | Brodersen et al. | Apr 2005 | A1 |
20050097097 | Hunt et al. | May 2005 | A1 |
20050283478 | Choi et al. | Dec 2005 | A1 |
20060021019 | Hinton et al. | Jan 2006 | A1 |
20060036576 | Simmen | Feb 2006 | A1 |
20060116976 | Legault et al. | Jun 2006 | A1 |
20060230124 | Belfiore et al. | Oct 2006 | A1 |
20060282328 | Gerace et al. | Dec 2006 | A1 |
20060294088 | Stecher et al. | Dec 2006 | A1 |
20070073695 | Conlan et al. | Mar 2007 | A1 |
20070077978 | Walker et al. | Apr 2007 | A1 |
20070124276 | Weissman et al. | May 2007 | A1 |
20070130117 | Lapstun et al. | Jun 2007 | A1 |
20070156650 | Becker | Jul 2007 | A1 |
20070156700 | Becker | Jul 2007 | A1 |
20070162969 | Becker | Jul 2007 | A1 |
20070198597 | Betz et al. | Aug 2007 | A1 |
20070214145 | Subramaniam et al. | Sep 2007 | A1 |
20070244849 | Predovic | Oct 2007 | A1 |
20070255715 | Li et al. | Nov 2007 | A1 |
20080010233 | Sack et al. | Jan 2008 | A1 |
20080065925 | Oliverio et al. | Mar 2008 | A1 |
20080082540 | Weissman et al. | Apr 2008 | A1 |
20080249972 | Dillon | Oct 2008 | A1 |
20090063415 | Chatfield et al. | Mar 2009 | A1 |
20090100342 | Jakobson | Apr 2009 | A1 |
20090150968 | Ozzie et al. | Jun 2009 | A1 |
20090177744 | Marlow et al. | Jul 2009 | A1 |
20110218958 | Warshavsky et al. | Sep 2011 | A1 |
20110247051 | Bulumulla et al. | Oct 2011 | A1 |
20120042218 | Cinarkaya et al. | Feb 2012 | A1 |
20120233137 | Jakobson et al. | Sep 2012 | A1 |
20120290407 | Hubbard et al. | Nov 2012 | A1 |
20130212497 | Zelenko et al. | Aug 2013 | A1 |
20130247216 | Cinarkaya et al. | Sep 2013 | A1 |
20140095545 | Weissman et al. | Apr 2014 | A1 |
Entry |
---|
International Search Report, Application No. PCT/US07/80266, mailed Jun. 17, 2008. |
Number | Date | Country | |
---|---|---|---|
20140095545 A1 | Apr 2014 | US |
Number | Date | Country | |
---|---|---|---|
60828019 | Oct 2006 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 13346622 | Jan 2012 | US |
Child | 14042514 | US | |
Parent | 11866184 | Oct 2007 | US |
Child | 13346622 | US |