Systems and methods for implementing and maintaining sampled tables in a database system
First Claim
1. A system to execute within a host organization, wherein the system comprises:
- a processor and a memory to execute instructions at the system;
a query optimizer to optimize database queries;
a database system having a plurality of database tables, each of the plurality of database tables to store database records, wherein each of the plurality of database tables embodies a trigger component, stored within the respective database table;
wherein the trigger component embodied within each respective database table is to initiate a hash function of the primary key for the respective database table upon a database insert transaction of a new database record being inserted into the respective database table;
a sample table within the query optimizer and maintained by the query optimizer separate from the plurality of database tables of the database system, wherein the sample table is to store a sample record corresponding to any database record being inserted into the respective database table of the database system which satisfies the sampling condition based on the hash function pursuant to the trigger component;
wherein the trigger component of each respective database table continuously maintains sampled records in the sample table upon any insert, change, or deletion to records within the respective database table satisfying the sampling condition based on the hash function;
wherein the hash function trigger is further configured to initiate the hash function upon any database record delete transaction for the table within which the respective hash function trigger resides and, responsive to a database record delete transaction, the hash function performs a hash of the primary key for a database record being deleted pursuant to the database record delete transaction to determine whether the database record being deleted satisfies the sampling condition indicating a sample record within the sample table must also be deleted or marked for deletion;
a primary key index providing an index of the primary keys of the sample records stored in the sample table;
a query interface to receive a query for the database system, wherein the queries to the database system are processed through the query interface and wherein the trigger component to initiate the hash function on database insert transactions resides within the query interface;
wherein the query optimizer is to optimize the received query by applying a plurality of filters to the sample table and selecting one of the plurality of filters based on which one of the plurality of filters corresponds to a greatest reduction in a number of records returned from the sample table, and wherein the query interface is to pass the trigger component to the query optimizer to perform the hash function for each database record being inserted into the database system to determine whether the database record being inserted satisfies a sampling condition; and
the query interface to execute the optimized query against the database system, wherein the optimized query applies the selected one of the plurality of filters to the database system in fulfillment of executing the received query.
1 Assignment
0 Petitions
Accused Products
Abstract
In accordance with disclosed embodiments, there are provided systems and methods for implementing and maintaining sampled tables in a database system. According to a particular embodiment such a system includes a processor and a memory to execute instructions at the system; a database to store database records; a query interface to submit queries to the database and receive results from the database; triggers to initiate a hash function on database insert transactions, the hash function to hash a primary key of each database record to be inserted into the database to determine whether a first hash value of the primary key of the database record to be inserted satisfies a sampling condition; a sample table to store a sample record corresponding to any database record to be inserted into the database which satisfies the sampling condition based on the hash function; a primary key index providing a first index of the primary keys of the sample records stored in the sample table; and an ordered hash index providing a second index on a second hash value corresponding to a second hash of the primary key of the sample records stored in the sample table ordered numerically by the second hash value. Other related embodiments are disclosed.
181 Citations
16 Claims
-
1. A system to execute within a host organization, wherein the system comprises:
-
a processor and a memory to execute instructions at the system; a query optimizer to optimize database queries; a database system having a plurality of database tables, each of the plurality of database tables to store database records, wherein each of the plurality of database tables embodies a trigger component, stored within the respective database table; wherein the trigger component embodied within each respective database table is to initiate a hash function of the primary key for the respective database table upon a database insert transaction of a new database record being inserted into the respective database table; a sample table within the query optimizer and maintained by the query optimizer separate from the plurality of database tables of the database system, wherein the sample table is to store a sample record corresponding to any database record being inserted into the respective database table of the database system which satisfies the sampling condition based on the hash function pursuant to the trigger component; wherein the trigger component of each respective database table continuously maintains sampled records in the sample table upon any insert, change, or deletion to records within the respective database table satisfying the sampling condition based on the hash function; wherein the hash function trigger is further configured to initiate the hash function upon any database record delete transaction for the table within which the respective hash function trigger resides and, responsive to a database record delete transaction, the hash function performs a hash of the primary key for a database record being deleted pursuant to the database record delete transaction to determine whether the database record being deleted satisfies the sampling condition indicating a sample record within the sample table must also be deleted or marked for deletion; a primary key index providing an index of the primary keys of the sample records stored in the sample table; a query interface to receive a query for the database system, wherein the queries to the database system are processed through the query interface and wherein the trigger component to initiate the hash function on database insert transactions resides within the query interface; wherein the query optimizer is to optimize the received query by applying a plurality of filters to the sample table and selecting one of the plurality of filters based on which one of the plurality of filters corresponds to a greatest reduction in a number of records returned from the sample table, and wherein the query interface is to pass the trigger component to the query optimizer to perform the hash function for each database record being inserted into the database system to determine whether the database record being inserted satisfies a sampling condition; and the query interface to execute the optimized query against the database system, wherein the optimized query applies the selected one of the plurality of filters to the database system in fulfillment of executing the received query. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
-
-
13. A method to execute within a host organization having at least a processor and a memory therein, wherein the method comprises:
-
storing records in a database system of the host organization, the database system having a plurality of database tables, each of the plurality of database tables to store database records, wherein each of the plurality of database tables embodies a trigger component, stored within the respective database table; embodying a trigger component within each respective database table, wherein the trigger component is to initiate a hash function of the primary key for the respective database table upon a database insert transaction of a new database record being inserted into the respective database table and upon any change or delete transaction for any of the database records within the respective database table; receiving database transactions at a query interface, the query interface to submit the database transactions to the database system; triggering, via the trigger component, a hash function for each one of the database transactions; wherein the hash function hashes a primary key of each database record being inserted at the database system at pursuant to the database transactions to determine whether a first hash value of the primary key of the database record being inserted satisfies a sampling condition; maintaining a sample table within a query optimizer, wherein the sample table is maintained by the query optimizer separate from the plurality of database tables of the database system, wherein the sample table is to store a sample record corresponding to any database record being inserted into the respective database table of the database system which satisfies the sampling condition based on the hash function pursuant to the trigger component and further wherein the sample table is to update or delete any database record being changed or deleted within the respective database table which satisfies the sampling condition based on the hash function pursuant to the trigger component; storing within the sample table, a sample record corresponding to any database record being inserted into the database which satisfies the sampling condition based on the hash function and updating within the sample table; continuously maintaining, via the trigger component embodied within the database tables, sampled records in the sample table upon any insert, change, or deletion to records within the respective database table satisfying the sampling condition based on the hash function; wherein triggering the hash function includes initiating the hash function upon any database record delete transaction for the table within which the respective hash function trigger resides and, responsive to a database record delete transaction, performing a hash of the primary key for a database record being deleted pursuant to the database record delete transaction to determine whether the database record being deleted satisfies the sampling condition indicating a sample record within the sample table must also be deleted or marked for deletion; providing a primary key index having therein an index of the primary keys of the sample records stored in the sample table; receiving a query at the query interface of the database system, wherein the queries to the database system are processed through the query interface and wherein the trigger component to initiate the hash function on database insert transactions resides within the query interface; optimizing the received query at the query optimizer of the host organization by applying a plurality of filters to the sample table and selecting one of the plurality of filters causing the fewest number of records to be returned from the sample table, and wherein the query interface is to pass the trigger component to the query optimizer to perform the hash function for each database record being inserted into the database system to determine whether the database record being inserted satisfies a sampling condition; and executing the optimized query against the database system, wherein the optimized query applies the selected one of the plurality of filters to the database system in fulfillment of executing the received query. - View Dependent Claims (14)
-
-
15. Non-transitory computer readable storage media having instructions stored thereon that, when executed by a processor of a system, the instructions cause the system to perform operations comprising:
-
storing records in a database system of the host organization, the database system having a plurality of database tables, each of the plurality of database tables to store database records, wherein each of the plurality of database tables embodies a trigger component, stored within the respective database table; embodying a trigger component within each respective database table, wherein the trigger component is to initiate a hash function of the primary key for the respective database table upon a database insert transaction of a new database record being inserted into the respective database table; receiving database transactions at a query interface, the query interface to submit the database transactions to the database system; triggering, via the trigger component, a hash function for each one of the database transactions; maintaining a sample table within a query optimizer, wherein the sample table is maintained by the query optimizer separate from the plurality of database tables of the database system, wherein the sample table is to store a sample record corresponding to any database record being inserted into the respective database table of the database system which satisfies the sampling condition based on the hash function pursuant to the trigger component; storing within the sample table, a sample record corresponding to any database record being inserted into the database which satisfies the sampling condition based on the hash function and updating within the sample table; continuously maintaining, via the trigger component embodied within the database tables, sampled records in the sample table upon any insert, change, or deletion to records within the respective database table satisfying the sampling condition based on the hash function; wherein triggering the hash function includes initiating the hash function upon any database record delete transaction for the table within which the respective hash function trigger resides and, responsive to a database record delete transaction, performing a hash of the primary key for a database record being deleted pursuant to the database record delete transaction to determine whether the database record being deleted satisfies the sampling condition indicating a sample record within the sample table must also be deleted or marked for deletion; providing a primary key index having therein an index of the primary keys of the sample records stored in the sample table; receiving a query at the query interface of the database system, wherein the queries to the database system are processed through the query interface and wherein the trigger component to initiate the hash function on database insert transactions resides within the query interface; optimizing the received query at the query optimizer of the host organization by applying a plurality of filters to the sample table and selecting one of the plurality of filters causing the fewest number of records to be returned from the sample table, and wherein the query interface is to pass the trigger component to the query optimizer to perform the hash function for each database record being inserted into the database system to determine whether the database record being inserted satisfies a sampling condition; and executing the optimized query against the database system, wherein the optimized query applies the selected one of the plurality of filters to the database system in fulfillment of executing the received query. - View Dependent Claims (16)
-
Specification