Database implementations for different application versions
A single database system with versioning techniques in a system catalog addresses the challenge of handling multiple application versions, enhancing performance and reducing errors by managing metadata for different application versions.
Patent Information
- Application Number
- JP2022567071
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-05-04
- Filing Date
- 2021-01-26
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-01-26
AI Technical Summary
Existing database management systems face challenges in handling multiple application versions, leading to downtime and performance issues due to database schema changes, which can hinder user experience and cause errors during query processing.
Implementing a single database system that maintains metadata for different application versions using a system catalog with versioning techniques, such as adding columns, retiring, and dropping database objects, to manage queries from various application versions efficiently.
Enables simultaneous servicing of multiple application versions without data duplication, reducing errors and delays by ensuring that each version can access the appropriate database objects, thus improving performance and user experience.
Smart Images

Figure 0007547707000008 
Figure 0007547707000003 
Figure 0007547707000001
Abstract
Description
[Technical field]
[0001] FIELD OF THE DISCLOSURE This disclosure relates generally to databases, and more specifically to implementing a single database for multiple application versions. [Background technology]
[0002] When an application is updated, it is often shut down while its corresponding database is updated, for example, using data definition language (DDL) statements. For example, the schema of the database may be changed for the updated application. This often results in downtime for the application, which may hinder the performance of the application and therefore the user experience. Additionally, the application owner or developer may wish to maintain the previous version of the application along with the updated new version of the application. Such multi-version implementation may result in errors and / or delays during implementation of the application by a database management system (DBMS) that is processing the database for the multiple versions of the application. For example, a database index for a new application version may interfere with the implementation of a previous version of the application. Specifically, when an index corresponding to a previous version of an application is dropped in the new version, the DBMS must prevent the newly created index from interfering with the previous version. If this prevention is not successful, delays may occur in processing queries from the previous version of the application. [Brief description of the drawings]
[0003] [Figure 1]FIG. 1 is a block diagram illustrating an example system configured to process database queries from different application versions, according to some embodiments.
[0004] [Diagram 2] FIG. 2 is a block diagram illustrating an example system catalog of a system of a database management system according to some embodiments.
[0005] [Diagram 3] FIG. 2 is a block diagram illustrating an example version catalog table and a schema catalog table, according to some embodiments.
[0006] [Figure 4] FIG. 2 is a block diagram illustrating an example database including an employee table for a human resources (HR) application, according to some embodiments.
[0007] [Figure 5A] FIG. 2 is a block diagram illustrating an example modification of a column catalog table based on adding a column to a database table in accordance with some embodiments. [Figure 5B] FIG. 1 is a block diagram illustrating exemplary changes to a column catalog table based on the retirement of a column to a database table, according to some embodiments. [Figure 5C] FIG. 1 is a block diagram illustrating an example modification of a column catalog table based on unretirement of a column to a database table, according to some embodiments. [Figure 5D] FIG. 1 is a block diagram illustrating an example modification of a column catalog table based on dropping a column to a database table, according to some embodiments.
[0008] [Figure 6]FIG. 1 is a block diagram illustrating an example database table catalog table during creation of a database table according to some embodiments.
[0009] [Figure 7] FIG. 2 is a block diagram illustrating an example index catalog table during creation of a database index, according to some embodiments.
[0010] [Figure 8] FIG. 13 is a block diagram illustrating an example trigger catalog table during addition of a database trigger in accordance with some embodiments.
[0011] [Figure 9] FIG. 13 is a block diagram illustrating an example procedure catalog table during addition of a database procedure, according to some embodiments.
[0012] [Figure 10] FIG. 13 is a block diagram illustrating an example statistics catalog table during addition of database statistics in accordance with some embodiments.
[0013] [Figure 11] FIG. 1 is a block diagram illustrating an example database query, according to some embodiments.
[0014] [Figure 12] FIG. 1 is a flow diagram illustrating a method for processing database queries from multiple different application versions according to some embodiments.
[0015] [Figure 13] FIG. 1 is a block diagram illustrating an exemplary computing device, according to some embodiments. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0016] This disclosure includes references to "one embodiment" or "an embodiment." The appearances of the phrases "in one embodiment" or "in an embodiment" do not necessarily refer to the same embodiment. The particular features, structures, or characteristics may be combined in any suitable manner not inconsistent with the disclosure.
[0017] In this disclosure, different entities (which may be variously referred to as "units," "circuits," other components, etc.) may be described or claimed as being "configured" to perform one or more tasks or operations. This formulation, i.e., an "entity" configured to perform one or more tasks, is used herein to refer to a structure (i.e., some physical thing, such as an electronic circuit). More specifically, this formulation is used to indicate that this structure is arranged to perform one or more tasks during operation. A structure may be said to be "configured" to perform some tasks even if the structure is not currently operating. A "computer system configured to receive database queries to a database" is intended to cover a computer system having, for example, a processor, a network interface, a memory with program instructions, etc., to perform this function during operation, even if the computer system is not currently in use (e.g., not connected to a power source). Thus, an entity described or defined as being "configured" to perform some tasks refers to some physical thing, such as a device, a circuit, a memory that stores executable program instructions to perform a task. The phrase is not used herein to refer to anything intangible.
[0018] The term "configured to" is not intended to mean "configurable to." For example, an unprogrammed FPGA may be "configurable to" perform some specified function, and once programmed, it will be "configured" to perform that function but will not be considered to be "configured" to perform that function.
[0019] As used herein, the terms "first," "second," etc. are used as antecedent noun labels and do not imply any kind of ordering (e.g., spatial, temporal, logical, etc.) unless specifically stated. For example, in a computing system with multiple user accounts, the terms "first" and "second" user accounts may be used to refer to any user. In other words, the "first" and "second" user accounts are not limited to, for example, the first two user accounts created.
[0020] As used herein, the term "based on" is used to describe one or more factors that influence the decision. This term does not exclude the possibility that additional factors may influence the decision. That is, the decision may be based only on the specified factors, or on the specified factors and other unspecified factors. Consider the phrase "determining A based on B." This phrase specifies that B is a factor used to determine A or that B influences the decision of A. This phrase does not exclude that the decision of A may also be based on other factors, such as C. This phrase is also intended to cover embodiments in which A is determined only based on B. Thus, as used herein, the phrase "based on" is synonymous with the phrase "based at least in part on."
[0021] In traditional DBMS implementations, one approach to handling multiple application versions involves a new version of the application accessing a database management system (DBMS) to retrieve data to process user requests. In this implementation, the DBMS may load a new database schema for that application into the database under a new schema name. In this example, the new database schema is simply a duplicate of the schema of the previous version of the application, but with changes that correspond to the execution of the new application. While this implementation works well for database objects that are easily copied (non-persistent objects such as triggers, indexes, statistics, etc.), it introduces problems for persistent database objects such as tables. For example, copying the entire contents of a database table multiple times for multiple different schemas is costly and inefficient.
[0022] This disclosure describes techniques for maintaining data for multiple different application versions in a single database. For example, the disclosed techniques handle queries from multiple application versions at a given point in time by implementing application versioning in the database's system catalog for different objects in the database. The system catalog holds metadata that describes the database objects stored in the database. For example, an application may be associated with a particular schema in the database, which includes a name and a version (such that a schema version corresponds to a given application version). The new versioning technique involves adding additional columns to the database catalog tables to specify the application versions associated with various database objects stored in the database. For example, these columns may specify a range of application versions using a start version and a stop version, or specify a specific application version for an object in the database. These database objects may include tables, columns, triggers, indexes, statistics, procedures, views, etc.
[0023] In an embodiment described herein, a new version of a client application may add a new column, "currency," to a "sales" database table. In this example, the database management system adds a new row to a table in a system catalog that contains metadata for the database column. This column catalog table specifies the name of the database table (sales), the name of the column being added (currency), and the start and stop versions of the application associated with the added database column. The database management techniques described in this disclosure may advantageously enable the servicing of multiple different versions of an application simultaneously while reducing or avoiding duplication of data stored in the database.
[0024] Example DBMS 1 is a block diagram illustrating an example system configured to process database queries from different application versions. In the illustrated embodiment, system 100 includes a user computing system 110 and a DBMS 130 that are configured to communicate to process application requests.
[0025] User computing system 110, in the illustrated embodiment, includes application 120. User computing system 110 may be an application server configured to facilitate use of application 120 by a variety of different users. For example, in some embodiments, system 110 may be a customer relationship management system that manages applications for a variety of different customers. In some situations, different users (of the same or different customers) use the same application, but implement different versions of the application. For example, system 110 may manage a human resources application for two different users, but each user implements a different version of the human resources application with access to different data maintained by the DBMS. In some embodiments, computing systems other than system 110 include different versions of application 120 and are configured to communicate with DBMS 130 to process queries from these applications. In the illustrated embodiment, user computing system 110 sends a query 102 for application 120 to DBMS 130. The query 102 specifies a particular application version.
[0026] In the illustrated embodiment, DBMS 130 includes system catalog 140 and database 150. As used herein, the term "system catalog" is intended to be interpreted according to its well-understood meaning and includes a portion of a database that stores metadata about data stored in the database, such as schemas that define database objects. For example, the system catalog may include various catalog tables and / or catalog views. These catalog tables may include metadata that describe data stored in various objects contained in the database managed by the DBMS, such as, for example, database tables, columns, triggers, indexes, statistics, procedures, views, etc. These catalog tables may be used, for example, to determine how best to evaluate a Structured Query Language (SQL) query received from an application. The terms "catalog" and "catalog table" may be used interchangeably. In this disclosure, a catalog table specifies a subset of a data set stored in a database that is accessible in different application versions, including which database tables are visible to a particular application.
[0027] In the illustrated embodiment, system catalog 140 is a collection of tables that contain information about database objects stored in database 150. For example, system catalog 140 may include a list of schema identifiers that correspond to different versions of an application (or different applications). System catalog 140 includes various catalog tables 142A-142N, each of which includes metadata for a different version. For example, in FIG. 1, catalog tables 142A-142N include metadata 144 for version A and version B of application 120. Exemplary catalog tables are discussed below with reference to FIG. 2.
[0028] Similarly, in the illustrated embodiment, database 150 includes various database tables 152A-152N, each of which includes data 154 for both version A and version B of application 120. In some implementations, catalog tables 142A-142N and database tables 152A-152N include metadata and data for different applications. For example, these tables may include metadata and data for both a human resources application and an accounting application. Additionally, these tables may include metadata and data for different applications and different versions of the same application. For example, application version A may be an older version of a particular application and may not be able to see data in columns that were added to the database for application version B, which is a newer version of the particular application. In this example, version A can still see data in columns that were removed or retired in version B. Stated another way, both application versions can see the same row of data with different sets of columns. DBMS 130 may be any of a variety of database management systems, including PostgreSQL, MySQL, ORACLE, and the like.
[0029] The metadata stored in catalog tables 142 may specify the locations of database objects stored in database 150 and version access information for those objects. That is, the metadata contained in catalog tables 142 may indicate, for a particular application version, the database objects stored in the database that are accessible to that application version and may be used to respond to queries from the particular application version.
[0030] In the illustrated embodiment, DBMS 130 accesses system catalog 140 based on query 102 to determine database objects stored in database 150 that are accessible to the application version specified in the query. Based on this determination, DBMS 130 may use a query optimizer to generate a query plan for execution against database 150. DBMS 130 then accesses database 150 based on this plan to retrieve data responsive to query 102. DBMS 130 sends query results 106 to user computing system 110 for application 120. These results are associated with the application version specified in query 102.
[0031] As used herein, the term "application version" refers to a particular format of an application that is different from a previous or later format of the application. For example, application versions may be assigned to new or updated versions of an application using a monotonically increasing numbering scheme that governs the accessibility of various database contents for different versions of the application. As a specific example, a first version of an HR application may be assigned version 4.1.3 and a second version of the HR application may be assigned version 4.1.4. As used herein, the term "metadata" is intended to be interpreted according to its well-understood meaning and includes a set of data that describes other data. For example, metadata may be included in a catalog table of a system catalog. Specifically, this metadata may specify an application version associated with a particular schema in a database. Exemplary metadata stored in a system catalog is discussed in detail below with reference to FIGS. 3 and 5A-10.
[0032] Example System Catalog 2 is a block diagram illustrating an example system catalog 140 of DBMS 130. In the illustrated embodiment, system catalog 140 includes a version catalog table 210, a schema catalog table 220, a column catalog table 230, a database table catalog table 240, an index catalog table 250, a trigger catalog table 260, a procedure catalog table 270, and a statistics catalog table 280. It is noted that any of a variety of other catalog tables for a variety of other types of database objects may be included in system catalog 140 and managed by DBMS 130.
[0033] 2 may contain entries (rows) for different objects in database 150. For example, column catalog table 230 may contain entries for various database columns, which include fields having values that specify the location of the column in database 150 and version access information. Further details for the different catalog tables are discussed below with reference to FIGS. 3 and 5A-10.
[0034] Example Version and Schema Catalog Tables 3 is a block diagram illustrating exemplary version and schema catalog tables. In the illustrated embodiment, the system catalog 140 includes a version catalog table 210 and a schema catalog table 220.
[0035] Version catalog table 210 is a table that allows DBMS 130 to look up a particular version ID for a name associated with a particular version of an application and determine the status of that particular version (e.g., whether the application version is active or retired). Version catalog table 210, in the illustrated embodiment, includes three columns: a version identifier (ID) 312, a version name 314, and a version status 316. Three different entries (rows) are shown within the table for three different versions of the application. Specifically, the first entry in version catalog table 210 includes schema information for application version 204.7.2, including the version name Summer 2019, and a version status indicating that this application version is retired. Similarly, application version 204.7.3 is named Fall 2019 and is active. Application version 204.7.4 is named Spring 2020 and is currently under construction. Version catalog table 210 may contain any number of entries where an application is at different versions and in different states with unique version IDs and application names.
[0036] In the illustrated embodiment, system catalog 140 includes a schema catalog table 220 that can be used to look up which particular schemas (based on their schema IDs) are applicable to a given schema name and a given application version. Specifically, schema catalog table 220 includes three columns that specify a schema ID 322, a schema name 324, and a version ID 312. The version ID 312 column of schema catalog table 220 is the same as the version ID column of version catalog table 210. The first schema (indicated by schema ID 1) is named HR (indicated by schema name 324 in FIG. 3) and corresponds to version ID 204.7.2. This pattern continues for the other schema IDs, with each new schema ID corresponding to a new version ID. However, schema ID 4 corresponds to a non-versioned schema. A non-versioned schema is a schema that is visible to existing versions of an application. In some situations, certain database objects (such as views and functions) may be placed in non-versioned schemas. This is because these database objects are expected to persist across application versions. Other database objects, such as database tables, may be placed in non-versioned schemas, allowing data stored in these objects to be available across various versions of an application, for example. In some cases, a version ID of 0 indicates that a database object has been retired or dropped. FIG. 5D shows an example of dropping a database column and a corresponding version ID of 0 for a starting version column. Although schemas may be defined (with a specific name) per application, a given schema may be shared by multiple instances of the same application. Thus, the name "HR" may be the name of a schema for a particular application, which may also be referred to as "HR" in some embodiments.
[0037] Although Figure 3 shows an entry for a schema named HR, this table may include entries for schemas with different names, such as Accounting, Hiring, Process, etc. A particular application may use multiple different schemas. As one specific example, an application associated with version 204.7.2 and generated in the summer of 2019 is a human resources application that may use the schemas "HR" and "Hiring."
[0038] Example Database 4 is a block diagram illustrating an example database 150 including an employee table 410 for a human resources (HR) application. In the illustrated embodiment, database 150 includes hr.employee table 410, hr.emp_name index 420, hr.emp_name_comp index 430, and hr.totalcomp procedure 440. The tables shown in FIG. 4 represent a superset of data that may be stored for the same application (or a different application) in DBMS 130, for example. As described in more detail below with respect to subsequent figures, a given application may be permitted to query only a subset of the information stored in database 150 based on version information defined in metadata 144 of system catalog 140.
[0039] The Hr.employee table 410, in the illustrated embodiment, includes four different columns: employee ID 412, employee name 414, salary 416, and bonus 418. The Hr.Employee table 410 includes three entries, one for each of Michael Smith, John Doe, and Jane Doe. For example, Jane Doe is associated with employee ID 12347, has a salary of $120,000, and a bonus of $6000. In some embodiments, the database 150 includes a second table named Client. This Client table may include data for different versions of an HR application along with the hr.employee table 410. In some situations, the employee and client tables include data for different applications (e.g., an HR application and an accounting application). As discussed below with reference to FIGS. 5A-5D and 11, certain application versions may not be able to access some of the columns included in the hr.employee table 410.
[0040] Hr.emp_name index 420 includes employee name 414 and salary 416 columns from employee table 410, and hr.emp_name_comp index 430 includes employee name 414 column from hr.employee table 410 and total 432 column that contains the total value of each employee's salary and bonus. For example, the value stored in total 432 column may be determined by executing hr.totalcomp procedure 440, which is a function that calculates the sum of two different parameters, salary and bonus. hr.totalcomp procedure 440 receives as input an employee ID or employee name and outputs the total compensation for that employee.
[0041] In some embodiments, database 150 includes additional database objects. For example, database 150 may include triggers and statistics, as well as any of a variety of other database objects. In particular, database 150 may include statistics for salary 416 column of hr.employee 410 that tracks the average salary of all employees listed in table 410. Information stored in database 150 may be accessible to application versions via queries that specify the respective application versions, as discussed below with reference to FIG. 11. For example, these database indexes may not be visible to a particular application version, but are visible to other versions of a particular application.
[0042] Example Catalog Table 5A-5D are block diagrams illustrating example changes to column catalog table 230 based on adding, retiring, unretirement, and dropping a column to a database table, respectively. In FIGURES 5A-5D, application 120 sends database commands to DBMS 130 specifying updates based on the new version of the application. These database commands may include, for example, data definition language (DDL) operations. In many situations, the new version of application 120 will be sending DDL operations to DBMS 130 based on which new information will be used by the application during operation.
[0043] In FIG. 5A, application 120 generates a database command 502 for database 150 and sends this command to DBMS 130. The database command sent from application 120 to DBMS 130 can be a SQL, Postgres, MySQL, etc. command. Database command 502 includes two different operations. The first operation specifies that the current application version is 204.7.3. For example, application version 204.7.3 is the application version associated with the second operation. The second operation specifies to update hr.employee table 410 by adding a bonus 418 column (e.g., if the employee table does not already include a bonus 418 column). Based on this database command, DBMS 130 updates the metadata stored in system catalog 140 and the database objects (not shown) stored in database 150.
[0044] 5A includes a column catalog table 230 that stores metadata for database columns contained in database 150. For example, returning to FIG. 3, database 150 includes hr.employee table 410 having four database columns: employee ID 412, employee name 414, salary 416, and bonus 418. Returning to FIG. 5A, column catalog table 230 includes five different columns: table ID 532, column number 534, column name 536, start version 590, and stop version 592. These five columns specify metadata for the database columns contained in database 150. For example, column catalog table 230 includes an entry that specifies that a database column named salary 416 is included in table ID 6 (hr.employee table 410), is associated with schema ID 3, and is available to applications starting with version 204.7.2. As one specific example, in the PostgreSQL context, the column catalog table 230 is called pg_attribute, and the term "attribute" is equivalent to column and is used for historical reasons.
[0045] In the illustrated embodiment, the start version 590 and stop version 592 columns in column catalog table 230 specify, for different database columns, the application versions in which the columns are accessible (start version 590) and the application versions in which those database columns are no longer accessible (stop version 592). For example, the start version and stop version columns in column catalog table 230 specify the range of application versions that recognize the data stored in a particular database column. For example, if application version 204.7.2 attempts to access all columns in hr.employee table 410, the bonus column data will not be listed among the column data returned to the application. Additionally, if this application version attempts to directly reference the bonus column in a query, the query response message will specify "bonus column not found."
[0046] The implementation of start version and stop version columns may advantageously prevent older application versions from slowing down due to their dependency on indexes that were dropped in newer application versions. This may also prevent newer application versions from violating service level agreements (SLAs) (e.g., queries from client applications must be satisfied in less than a threshold time). Additionally, the use of start version and stop version columns may store information about multiple application versions in a single table, rather than multiple tables, each dedicated to a particular version. This may reduce or eliminate the need for a DBMS to keep data synchronized across multiple tables. Versioning of column data may reduce or eliminate the risk of semantically breaking an application due to, for example, a single copy of a database table that includes columns that are visible to all application versions. In this exemplary situation, the query "SELECT *FROM employee Table" returns the extra columns. The disclosed versioning techniques may also reduce or prevent data stored in columns to be retired from a database table in a newer version from being inadvertently accessed by a newer version of an application in situations where the application developer was not aware that this data was stored in the retired object.
[0047] DBMS 130 receives database command 502 from application 120 and, based on the command, executes an executable DDL operation to add a column (bonus 418 in FIG. 4 ) to database 150. In addition to the DDL operation on database 150, DBMS 130 simultaneously updates column catalog table 230 by executing add column 512 operation. For example, add column 504 operation is executable to add an entry to column catalog table 230. Specifically, DBMS 130 adds a row to column catalog table 230 having a value that specifies that the new column is named “bonus” and is included in the employee table corresponding to table ID 6 (the new row is shown in bold in the figure). In the depicted example, the bonus database column is accessible in application version 204.7.3 and later versions, but not in application version 204.7.2 and earlier versions.
[0048] In some embodiments, system catalog 140 includes primary keys and unique constraints for different catalog tables. A primary key may include a set of columns with unique values in a table that are used to identify a row when referenced from another table. For example, column catalog table 230 may include a primary key made up of table ID 532 and column number 534 columns. This primary key can be used to identify a particular row in column catalog table 230. Similarly, a unique constraint may include a set of columns with unique values. For example, column catalog table 230 may include a unique constraint made up of table ID 532 and column name 536 columns.
[0049] In some embodiments, the database command includes multiple updates to a given application version. For example, database command 502 may include multiple different operations (e.g., a second operation "ALTER TABLE") that indicate differences between database objects accessible in a previous version and database objects accessible in version 204.7.3.
[0050] 5B, application 120 sends database command 504 to DBMS 130 specifying application version 204.7.4 and including an operation to retire a database column. Based on database command 504, DBMS 130 executes retire column 514 operation to modify column catalog table 230 by adding retired version 592 (204.7.4) to the row of table 230 that contains metadata for the bonus database column. In this example, the bonus column in the employee database table is accessible only in version 204.7.3 of the human resources application.
[0051] In some circumstances, during development of application version 204.7.3 (e.g., prior to publishing the retired column via a new application release), the retirement of the bonus column may result in an error. This retirement may be reversed within the same application version. To mitigate this error, application 120 may unretire the bonus column. For example, in FIG. 5C , application 120 sends database command 506 to DBMS 130 that specifies application version 204.7.4. Database command 506 includes an operation to unretire the bonus column in database 150. Based on this command, DBMS 130 performs an unretire column 516 operation to update column catalog table 230 to specify a stop version 592 of “0” for the bonus database column.
[0052] In FIG. 5D , application 120 sends database command 508 to DBMS 130, which includes an operation that specifies dropping the bonus column in database 150. Based on database command 508, DBMS 130 executes drop column operation 518 to update column catalog table 230 such that its start version column 590 specifies a version of "0" for the bonus database column. In some circumstances, application 120 is permitted to drop a column (or other database object) only when the column is no longer available for other application versions. That is, the stop version 592 column for the bonus column should specify an application version that is older than or equal to the oldest version of the application. For example, a column may be dropped when the column is retired in an application version that is older than the last supported version of the application.
[0053] 6 is a block diagram illustrating an example database table catalog table during the creation of a database table. In the illustrated embodiment, database catalog table 240 includes the following columns that contain metadata specifying the data stored in the table in database 150: table ID 542, schema ID 322, table name 644, start version 590, and stop version 592. Database catalog table 240 includes metadata specifying whether information stored in a database table in database 150 is visible in different application versions. For example, the first row of database table catalog table 240 contains a table ID of 6, a schema ID of 4, is named "Employee" and is accessible to an application starting with application version 204.7.1. Schema ID 4 refers to a non-versioned schema, and therefore the employee table (table ID 6) may be visible in multiple different application versions. In some situations, it may be desirable to have database tables visible across application versions, and therefore these database tables may exist in a non-versioned schema.
[0054] In the illustrated embodiment, application 120 sends a database command 602 to DBMS 130. The database command includes an operation to create a table in database 150 called "client." After creating the client table in database 150, DBMS 130 performs a create database table operation 612 to add an entry to database table catalog table 240 in system catalog 140. In the illustrated embodiment, a second row in database table catalog table 240 specifies application version 204.7.1 as the starting version 590 for the client database table. In this example, both the employee database table and the client database table are accessible to the application associated with version 204.7.1 and later.
[0055] 7 is a block diagram illustrating an exemplary index catalog table during the creation of a database index. In the illustrated embodiment, index catalog table 250 includes columns that contain metadata specifying the data stored in indexes in database 150: table ID 542, index name 764, start version 590, and stop version 592. For example, index name 764 column specifies values that specify names of various database indexes.
[0056] In the illustrated embodiment, DBMS 130 receives database command 702 from application 120 specifying the creation of a new index in database 150. Based on this command, DBMS 130 creates a new index hr.emp_name_comp 430. After creating the new index, DBMS 130 performs create index operation 712 to add an entry to index catalog table 250 for index 430 indicating that the index is accessible to application version 204.7.3 (and newer versions) and therefore that the index is not usable by application version 204.7.2 and older versions. However, DBMS 130 maintains the indexes present in the database even when those indexes are not usable (available) by a particular application version (e.g., version 204.7.2 and older).
[0057] 8 is a block diagram illustrating an exemplary trigger catalog table during addition of a database trigger. In the illustrated embodiment, trigger catalog table 260 includes the following columns with metadata specifying triggers stored in database 150: table ID 532, trigger ID 862, trigger name 864, start version 590, and stop version 592. Trigger ID 862 and trigger name 864 store values that specify identifiers and names, respectively, for various database triggers.
[0058] In the illustrated embodiment, DBMS 130 receives database command 802 from application 120 specifying to add a trigger to database 150. Based on the command, DBMS 130 creates a new trigger on the bonus column of the employee table in database 150. After the DBMS adds the trigger to database 150, it performs add trigger operation 812 to add an entry to trigger catalog table 260 for the new "bonus_trigger" for application version 204.7.3. In this example, "bonus_trigger" executes only for applications associated with versions 204.7.3 and later.
[0059] 9 is a block diagram illustrating an example procedure catalog table during the addition of a database procedure. In the illustrated embodiment, procedure catalog table 270 includes the following columns with metadata specifying procedures stored in database 150: procedure ID 972, schema ID 974, and procedure name 976. The procedure ID 972 and procedure name 976 columns store values that specify, for example, the identifiers and names, respectively, of various database procedures.
[0060] In the illustrated embodiment, DBMS 130 receives database command 902 from application 120 specifying adding a procedure to database 150. Based on this command, DBMS 130 creates a new procedure called "retirement" for a particular schema in database 150 (corresponding to application version 204.7.4 according to schema catalog table 220 of FIG. 3). After DBMS 130 adds the new procedure to database 150, it performs add procedure operation 912 to add an entry for the new "retirement" procedure for schema ID3 to procedure catalog table 270. In this example, procedure "retirement" is visible only to queries for the application associated with version 204.7.4.
[0061] 10 is a block diagram illustrating an exemplary statistics catalog table during the addition of database statistics. In the illustrated embodiment, the statistics catalog table 280 includes the following columns with metadata specifying statistics for different database tables stored in the database 150: table ID 532, width statistics 982, null statistics 984, start version 590, and stop version 592. Width statistics 982 and null statistics 984 are non-limiting examples of the types of statistics that may be generated for a given database table. Width statistics 982 may specify, for example, the average storage width in bytes of non-null entries in a given database table.
[0062] In the illustrated embodiment, database command 1002 includes an operation to load statistics for hr.employee database table 410 into database 150. After DBMS 130 performs this operation, it performs add statistics operation 1012 to add an entry to statistics catalog table 280 that specifies width and null statistics for human resources application version 204.7.2. In this example, the query optimizer for DBMS 130 can only use null statistics for queries from applications associated with versions 204.7.2 and later.
[0063] 11 is a block diagram illustrating an exemplary database query. In the illustrated embodiment, system 1100 includes application 120 and DBMS 130. Application 120 sends query 1102 to DBMS 130. Query 1102 specifies that application 120 is currently running under version 204.7.2 and therefore the query is requesting access to database objects accessible under this version. In addition, query 1102 specifies to select data generated by hr.totalcomp procedure 440 for employees named "John Doe."
[0064] The following exemplary description includes references to the database objects shown in Figure 4. Application 120 shown in Figure 11 may be a human resources application that requests compensation information for a particular employee (John Doe). To respond to query 1102, DBMS 130 accesses system catalog 140 to determine whether procedure "totalcomp" belongs to schema ID1. Based on determining that it does in fact belong to schema 1, DBMS 130 verifies that 1) schema ID1 is a schema named "HR" and 2) schema ID1 is a schema that matches application version 204.7.2. Based on this information, DBMS 130 accesses database 150 to obtain the calculated total compensation (salary + bonus) for John Doe.
[0065] Note that query 1102 can be satisfied either by accessing hr.employee table 410 to obtain John Doe's salary and bonus information, accessing Hr.totalcomp procedure 440, and then plugging these values into procedure 440, or by accessing hr.emp_name_comp index 430 (if this index was accessible in application version 204.7.3, in which case it is accessible) and obtaining the sum 432 of the salary 416 and bonus 418 columns for John Doe. If DBMS 130 uses the hr.emp_name_comp index to respond to query 1102, the system first accesses index catalog table 250 to determine that the hr.emp_name_comp index is accessible starting with application version 204.7.3. In this exemplary scenario, DBMS 130 then checks that the salary, bonus, and name columns of hr.employee table 410 are visible to application version 204.7.3. The DBMS then determines that the emp_name and emp_name_comp indexes are visible to application version 204.7.3. Based on this information, DBMS 130 then accesses database index 430 to retrieve the data requested by application 120. If the emp_name_comp index had been added in application version 204.7.4 but not in application version 204.7.3, DBMS 130 would need to refrain from using this index. In the illustrated embodiment, after DBMS 130 accesses database 150 to retrieve the total compensation for John Doe, it sends query result 1104 to application 120 specifying that the total compensation for John Doe is $210,000.
[0066] Exemplary Methods Referring now to Figure 12, a flow diagram illustrates an exemplary method 1200 for processing database queries from different application versions. The method shown in Figure 12 may be used in conjunction with any of computer circuits, systems, devices, elements, or components, among other devices. In various embodiments, some of the method elements shown may be performed simultaneously, in a different order than shown, or may be omitted. Additional method elements may also be performed as desired.
[0067] At 1210, in an illustrated embodiment, a computer system running a database management system (DBMS) receives a database query for a database, the database query being received from a particular version of an application having multiple versions, the database query specifying the particular version. In some embodiments, the computer system receives updates for the application from the particular version of the application prior to receiving the database query for the database, the updates being associated with the particular version. In some embodiments, the computer system modifies one or more catalog tables based on the received updates, the modifications including modifying metadata stored in the catalog tables that specify one or more database objects stored in the database accessible at the particular version. In some implementations, the updates indicate one or more differences between database objects accessible at the particular version and database objects accessible at a previous version of the application.
[0068] In some implementations, a DBMS may receive database queries that do not specify a particular application version. For example, in some situations, the current application version may be known to the DBMS, and this known application version is used to receive queries unless and until the DBMS receives a SET command that specifies a different application version (e.g., the SET commands shown in Figures 5A-8 and 10-11).
[0069] At 1220, the computer system identifies one or more catalog tables, the one or more catalog tables including one or more version information columns that store version access information. In some embodiments, the one or more version information columns include a start version column and a stop version column that specify a range of application versions in which one or more database objects stored in the database are accessible. For example, the start version column may indicate an application version in which the database object began to be available, and the stop version column may indicate an application version in which the database object is no longer accessible. In other words, the stop version column may specify an application version (and any subsequent application versions) in which the database object is not accessible. In some embodiments, the version information column specifies version access information for the one or more database objects. In some embodiments, the one or more database objects include one or more of the following types of objects: schema, table, column, index, trigger, procedure, and statistic. The one or more database objects may include any of the various combinations of object types included in this list, or any of the various other types of database objects not explicitly specified in the list above. For example, database objects stored in a database may include schema objects and database objects, schema objects or table objects but not both, all seven types of database objects, or any combination thereof. In some embodiments, one of the catalog tables is a schema catalog table that specifies, for at least one application, the schemas applicable to the one application. In some embodiments, the schema catalog table specifies schema names that correspond to different applications.
[0070] In some embodiments, a database object is accessible in a single application version. In other embodiments, a database object may have a lifetime that spans multiple versions of an application. The lifetime of a database object may be specified by a start version column and a stop version column. However, in other situations, the lifetime of a database object may be specified by a single column using an interval data type. In this situation, the single column specifies the range of application versions that have access to the database object.
[0071] In some embodiments, the version information column specifies version access information for at least one schema object and database table object of the database, where the schema object is a named collection of tables and the database table object is a particular type of table that stores data in the database for an application having multiple versions. In some embodiments, the identified catalog tables include a first catalog table that defines the version access information in a first format and a second catalog table that defines the version access information in a second format. In some embodiments, the first format specifies the version access information as a particular application version and the second format specifies the version access information as a range of application versions.
[0072] At 1230, the computer system determines that the version access information for the database query indicates that one or more database objects corresponding to the database query are accessible in a particular version of the application.
[0073] At 1240, the computer system, based on the determination, in response to the database query, accesses one or more database objects accessible in the particular version of the application. In some embodiments, the version access information for the database query allows access to a first portion of data contained in the one or more database objects for the particular version of the application. For example, information stored in salary column 416 in hr.employee table 410 (one example of a database object) may be accessible in the particular version of the application. In some embodiments, in response to receiving an additional database query from a different version of the application, the computing system accesses a second portion of data contained in the one or more database objects based on the version access information for the different version of the application. For example, information stored in both salary column 416 and bonus column 418 may be included in the hr.employee table and accessible to the different version of the application. In some embodiments, based on receiving database queries from two different versions of the application and their respective version access information, the computer system accesses different database objects. For example, a computing system may determine that the hr.employee table 410 (one example database object) is accessible in a first application version, while the client table (another example database object) is accessible in a second application version.
[0074] In some embodiments, the computer system adds an index table to a database. In some embodiments, based on adding the index table, the computer system adds a row to an index catalog table that includes metadata for one or more index tables in the database, the row including respective values for a start version column and a stop version column that specify information indicative of one or more versions of an application to which one or more database objects stored in the database are accessible.
[0075] In some embodiments, the particular version of the application sends a database query to the DBMS, the database query specifying the particular version of the application. In some embodiments, the database maintains version access information in one or more version information columns of one or more catalog tables. In some embodiments, the particular version of the application receives data from the DBMS responsive to the database query. In some embodiments, the data is retrieved from the database based on the version access information specifying that the data is accessible to the particular version of the application. In some embodiments, the particular version of the application sends updates to one or more database objects to the DBMS, the updates being associated with the particular version. In some implementations, the updates include changes to metadata stored in one or more catalog tables.
[0076] 13, a block diagram of a computing device (also referred to as a computing system) 1310 is shown according to some embodiments. The computing device 1310 may be used to implement various portions of the present disclosure. The computing device 1310 is an example of an apparatus that may be used as a mobile device, a server computer system, a client computer system, or any other computing system that implements portions of the present disclosure. For example, the computing device 1310 may implement the computing system 110 and / or the DBMS 130. In some situations, the computing device 1310 executes the application 130.
[0077] Computing device 1310 may be any suitable type of device, including, but not limited to, a personal computer system, a desktop computer, a laptop or notebook computer, a mobile phone, a mainframe computer system, a web server, a workstation, or a network computer. As shown, computing device 1310 includes a processing unit 1350, a storage subsystem 1312, and an input / output (I / O) interface 1330 coupled via an interconnect 1360 (e.g., a system bus). The input / output interface 1330 may be coupled to one or more I / O devices 1340. Computing device 1310 further includes a network interface 1332 that may be coupled to a network 1320, for example, to communicate with other computing devices.
[0078] Processing unit 1350 includes one or more processors, and in some embodiments, one or more co-processing units. In some embodiments, multiple instances of processing unit 1350 may be coupled to interconnect 1360. Processing unit 1350 (or each processor in processing unit 1350) may include a cache or other form of on-board memory. In some embodiments, processing unit 1350 may be implemented as a general-purpose processing unit, and in other embodiments, as a special-purpose processing unit (e.g., an ASIC). In general, computing device 1310 is not limited to any particular type of processing unit or processor subsystem.
[0079] As used herein, the term "processing unit" refers to a circuit configured to perform an operation. Thus, a processing unit may be implemented as a hardware circuit that is implemented in a variety of ways. The hardware circuit may include, for example, custom very large scale integrated (VLSI) circuits or gate arrays, off-the-shelf semiconductors such as logic chips, transistors, or other discrete components. A processing unit may also be implemented in a programmable hardware device such as a field programmable gate array, programmable array logic, programmable logic device, or the like.
[0080] The storage subsystem 1312 is usable by the processing unit 1350 (e.g., stores instructions executable by and data used by the processing unit 1350). The storage subsystem 1312 may be implemented by any suitable type of physical memory medium, including hard disk storage, floppy disk storage, removable disk storage, flash memory, random access memory (RAM-SRAM, EDO RAM, SDRAM, DDR SDRAM, RDRAM, etc.), ROM (PROM, EEPROM, etc.), etc. The storage subsystem 1312 may consist solely of volatile memory in some embodiments. The storage subsystem 1312 may store program instructions executable by the computing device 1310 using the processing unit 1350, including program instructions executable to cause the computing device 1310 to perform the various techniques disclosed herein.
[0081] I / O interface 1330 may represent one or more interfaces, and may be any of a variety of types of interfaces configured to couple to and communicate with other devices according to various embodiments. In some embodiments, I / O interface 1330 is a bridge chip from a frontside to one or more backside buses. I / O interface 1330 may be coupled to one or more I / O devices 1340 via one or more corresponding buses or other interfaces. Examples of I / O interfaces include storage devices (hard disks, optical drives, removable flash drives, storage arrays, SANs, or associated controllers), network interface devices, user interface devices, or other devices (e.g., graphics, sound, etc.).
[0082] It is noted that the computing device of Figure 13 is one embodiment for demonstrating the disclosed concepts. In other embodiments, various aspects of the computing device may differ. For example, in some embodiments, additional components or multiple instances of the illustrated components may be included.
[0083] Implementations of the subject matter of the application include, but are not limited to, Examples 1-20 below. (Example 1) receiving, by a computer system executing a database management system (DBMS), a database query for a database, the database query being received from a particular version of an application having multiple versions, the database query specifying the particular version; identifying, by a computer system, one or more catalog tables, the one or more catalog tables including one or more version information columns that store version access information; determining, by the computer system, that version access information for the database query indicates that one or more database objects corresponding to the database query are accessible in a particular version of the application; and accessing, by the computer system, in response to the database query based on the determination, one or more database objects accessible in the particular version of the application. (Example 2) 2. The method of example 1, wherein the one or more version information columns include a version column that specifies information indicative of a range of application versions for which one or more database objects stored in the database are accessible. (Example 3) The method of Example 1, wherein the version information column specifies version access information for one or more database objects, the one or more database objects including one or more of the following types of objects: schemas, tables, columns, indexes, triggers, procedures, and statistics. (Example 4) Before receiving a database query to the database, receiving, by a computer system, an update to an application from a particular version of the application, the update being associated with the particular version; The method of Example 1, further comprising modifying, by the computer system, one or more catalog tables based on the received updates, the modifications modifying metadata stored in the catalog tables that specify one or more database objects stored in the database that are accessible at a particular version. (Example 5) 5. The method of example 4, wherein the updates indicate one or more differences between database objects accessible in a particular version and database objects accessible in a previous version of the application. (Example 6) 2. The method of example 1, wherein one of the catalog tables is a schema catalog table that specifies, for at least one application, schemas applicable to the one application. (Example 7) The version access information for the database query grants access to a first portion of the data contained in the one or more database objects for a particular version of the application, and the method includes: The method of Example 1, further comprising, in response to receiving additional database queries from the different versions of the application, accessing, by the computer system, different second portions of the data included in the one or more database objects based on the version access information for the different versions of the application. (Example 8) 2. The method of claim 1, wherein the identified catalog tables include a first catalog table that defines version access information in a first format and a second catalog table that defines version access information in a second format. (Example 9) 9. The method of example 8, wherein the first format specifies the version access information as a specific application version and the second format specifies the version access information as a range of application versions. (Example 10) A non-transitory computer-readable medium having stored thereon instructions that can cause a computing device executing a database management system (DBMS) to perform operations, the operations including: receiving a database query for a database, the database query being received from a particular version of an application having multiple versions, the database query specifying the particular version; identifying one or more catalog tables, the one or more catalog tables including one or more version information columns that store version access information; determining that version access information for the database query indicates that one or more database objects corresponding to the database query are accessible in a particular version of the application; and accessing, in response to a database query based on the determination, one or more database objects accessible in the particular version of the application. (Example 11) 11. The non-transitory computer-readable medium of Example 10, wherein the one or more version information columns include a start version column and a stop version column that specify a range of application versions within which one or more database objects stored in the database are accessible. (Example 12) The non-transitory computer-readable medium of Example 10, wherein the version information column specifies version access information for at least one schema object and database table object of the database, where the schema object is a named collection of tables and the database table object is a particular type of table that stores data in the database for an application having multiple versions. (Example 13) Before receiving a database query to the database, receiving an update to the application from a particular version of the application, the update being associated with the particular version; The non-transitory computer-readable medium of Example 10, further comprising: modifying one or more catalog tables based on the received updates, the modifications modifying metadata stored in the catalog tables that specify one or more database objects stored in the database that are accessible at a particular version. (Example 14) 11. The non-transitory computer-readable medium of Example 10, wherein one of the catalog tables is a schema catalog table that specifies, for at least one application, schemas applicable to the one application, the schema catalog table specifying schema names that correspond to different applications. (Example 15) Adding an index table to the database; 11. The non-transitory computer-readable medium of Example 10, further comprising: adding a row to an index catalog table including metadata for one or more index tables in the database based on adding the index table, the row including respective values for a start version column and a stop version column that specify information indicating one or more versions of an application in which one or more database objects stored in the database are accessible. (Example 16) The version access information for the database query grants access to a first portion of the data contained in the one or more database objects for a particular version of the application, and the operation comprises: The non-transitory computer-readable medium of Example 10, further comprising, in response to receiving an additional database query from a different version of the application, accessing a different second portion of the data included in the one or more database objects based on the version access information for the different version of the application. (Example 17) sending a database query to a database management system (DBMS) for a database with a particular version of the application, the database query specifying a particular version of the application, the database maintaining version access information in one or more version information columns in one or more catalog tables; and receiving, from a DBMS, data responsive to a database query by a particular version of the application, the data being retrieved from the database based on version access information indicating that one or more database objects are accessible to the particular version of the application. (Example 18) 18. The method of Example 17, further comprising sending updates to the one or more database objects by a particular version of the application to the DBMS, the updates being associated with the particular version, and the updates including changes to metadata stored in one or more catalog tables. (Example 19) 18. The method of example 17, wherein one of the catalog tables is a schema catalog table that specifies, for at least one application, the schemas applicable to the one application. (Example 20) 18. The method of example 17, wherein the one or more version information columns include a version column that specifies information indicative of a range of application versions for which one or more database objects stored in the database are accessible.
[0084] Although specific embodiments have been described above, these embodiments are not intended to limit the scope of the present disclosure, even if a single embodiment is described with respect to a particular feature. The examples of features provided in this disclosure are intended to be illustrative rather than limiting, unless otherwise specified. The above description is intended to cover alternatives, modifications, and equivalents as would be apparent to one skilled in the art having the benefit of this disclosure.
[0085] The scope of the present disclosure includes any feature or combination of features (either explicit or implicit) disclosed herein, or any generalization thereof, whether or not it alleviates any or all of the problems addressed herein. Accordingly, new claims may be formulated during prosecution of this application (or any application claiming priority thereto) for such combinations of features. In particular, with reference to the appended claims, features from the dependent claims may be combined with features of the independent claims, and features from each independent claim may be combined in any suitable manner and not just in the specific combinations recited in the appended claims.
Claims
1. receiving, by a computer system executing a database management system (DBMS), a database query for a database, the database query being received from a particular version of an application having multiple versions, the database query specifying the particular version; identifying, by the computer system, one or more catalog tables, the one or more catalog tables including a first column including a start version column and a different second column including a stop version column, the start version column and the stop version column for a given database object specifying a range of application versions within which the given database object is accessible; determining, by the computer system, that one or more database objects corresponding to the database query are accessible in the particular version of the application based on version access information stored in the one or more catalog tables; and accessing, by the computer system, in response to the database query based on the determination, one or more database objects accessible in the particular version of the application.
2. The method described in claim 1, wherein the start version column and the stop version column included in a catalog table for a column database object included in a database table object stored in the database specify a range of two or more application versions for which the column database object is accessible.
3. A method according to any one of claims 1 and 2, wherein the start version column and the stop version column specify version access information for one or more of schemas, tables, columns, indexes, triggers, procedures, and statistics.
4. prior to receiving the database query for the database; receiving, by the computer system, an update to the application from the particular version of the application, the update being associated with the particular version; 4. The method of claim 1, further comprising: modifying, by the computer system, the one or more catalog tables based on the received updates, the modification modifying metadata stored in the catalog tables that specifies one or more database objects stored in the database that are accessible at the particular version.
5. The method of claim 4 , wherein the updates indicate one or more differences between database objects accessible in the particular version and database objects accessible in a previous version of the application.
6. The method of any one of claims 1 to 5, wherein one of the catalog tables is a schema catalog table that specifies, for at least one application, the schema applicable to that one application.
7. The version access information for the database query grants access to a first portion of data contained in the one or more database objects for the particular version of the application, the method comprising:
7. The method of claim 1, further comprising, in response to receiving an additional database query from a different version of the application, accessing, by the computer system, a different second portion of the data contained in the one or more database objects based on version access information for the different version of the application.
8. 8. The method of claim 1, wherein the identified catalog tables include a first catalog table that defines version access information in a first format and a second catalog table that defines version access information in a second format.
9. 9. The method of claim 8, wherein the first format specifies version access information as a specific application version and the second format specifies version access information as a range of application versions.
10. At least one processor; A memory storing program instructions executable by said at least one processor to perform the method of any one of claims 1 to 9.
11. 1. A non-transitory computer-readable medium having stored thereon instructions capable of causing a computing device executing a database management system (DBMS) to perform operations, the operations comprising: receiving a database query for a database, the database query being received from a particular version of an application having multiple versions, the database query specifying the particular version; identifying one or more catalog tables, the one or more catalog tables including a first column comprising a start version column and a different second column comprising a stop version column, the start version column and the stop version column for a given database object specifying a range of application versions within which the given database object is accessible; determining, based on version access information stored in the one or more catalog tables, that one or more database objects corresponding to the database query are accessible in the particular version of the application; and accessing, in response to the database query based on the determination, one or more database objects accessible to the particular version of the application.
12. 12. The non-transitory computer-readable medium of claim 11, wherein the one or more version information columns include a start version column and a stop version column included in a catalog table for a column database object included in a database table object stored in the database, the start version column and the stop version column specify a range of two or more application versions within which the column database object is accessible.
13. A non-transitory computer-readable medium as described in any one of claims 11 and 12, wherein the start version column and the stop version column specify version access information for at least one schema object and database table object of the database, the schema object being a named collection of tables, and the database table object being a particular type of table that stores data in the database for the application having the multiple versions.
14. The operation includes: prior to receiving the database query for the database; receiving an update to the application from the particular version of the application, the update being associated with the particular version; 14. The non-transitory computer-readable medium of claim 11, further comprising: modifying the one or more catalog tables based on the received updates, the modification modifying metadata stored in the catalog tables that specify one or more database objects stored in the database that are accessible at the particular version.
15. 15. The non-transitory computer-readable medium of claim 11, wherein one of the catalog tables is a schema catalog table that specifies, for at least one application, schemas applicable to the one application, the schema catalog table specifying schema names that correspond to different applications.
Citation Information
Patent Citations
Database device, and schema management device and method therefor
JP2005078237A
Apparatus and method for processing data and program
JP2011215984A
Data versioning through data transformations
US20110173168A1
Database server storing plurality of versions of data, and database management method
WO2014181475A1
