Query external tables in the database system

By introducing the concepts of external tables and data lakes into the database system, the bottleneck of the shared disk system and the high cost of traditional database management are solved, efficient data management and query performance are improved, and the scalability and disaster recovery of the system are enhanced. ability.

CN112567358BActive Publication Date: 2024-08-27SNOWFLAKE INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202080004524.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2019-04-16
Filing Date
2020-04-15
Publication Date
2024-08-27
Estimated Expiration
2040-04-15

AI Technical Summary

Technical Problem

In the existing shared disk system, the communication link between the processing node and the storage device becomes a bottleneck in the database, causing data read and write operations to slow down, limiting the scalability of the system, and traditional database management is expensive and Resource intensive and difficult to protect data in disaster situations.

Method used

By introducing the concept of external tables into the database system, the database platform is allowed to read and manage external data without copying it to internal storage, using external data storage platforms such as data lakes to store and manage data, and generate materialized views. To improve query performance and achieve metadata generation and maintenance.

Benefits of technology

It improves the response time of database queries and computing resource utilization, reduces management costs, enhances data scalability and disaster recovery capabilities, and reduces dependence on traditional database resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112567358B_ABST
    Figure CN112567358B_ABST
Patent Text Reader

Abstract

Systems, methods, and devices for querying external tables are disclosed. A method includes connecting a database platform to an external table so that the database platform has read access to the external table but does not have write access to the external table. The method includes receiving a query including a predicate, the query being directed at least to data in the external table. The method includes determining, based on metadata, one or more partitions in the external table that include data that satisfies the predicate. The method includes pruning all partitions in the external table that do not include any data that satisfies the predicate based on the metadata. The method includes generating a query plan that includes a plurality of discrete subtasks. The method includes assigning the plurality of discrete subtasks to one or more nodes in an execution platform based on the metadata.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to U.S. patent application serial number 16 / 385,774, filed on April 16, 2019, the contents of which are incorporated herein by reference in their entirety. Technical Field

[0003] The present disclosure relates to databases, and more particularly to external tables in database systems.

[0004] background

[0005] Databases are widely used for data storage and access in computing applications. The goal of database storage is to provide large amounts of information in an organized manner so that it can be accessed, managed, and updated. In a database, data can be organized into rows, columns, and tables. Different database storage systems can be used to store different types of content, such as bibliographic, full-text, digital, and / or image content. Furthermore, in computing, different database systems can be classified based on the organization method of the database. There are many different types of databases, including relational databases, distributed databases, cloud databases, object-oriented databases, and others.

[0006] Databases are used by various entities and companies to store information that may need to be accessed or analyzed. In an example, a retail company may store a list of all sales transactions in a database. The database may include information such as when the transaction occurred, where the transaction occurred, the total cost of the transaction, identifiers and / or descriptions of all items purchased in the transaction, etc. The same retail company may also store employee information in the same database, for example, the information may include employee names, employee contact information, employee work history, employee compensation rates, etc. Depending on the needs of the retail company, employee information and transaction information may be stored in different tables in the same database. When a retail company wants to know the information stored in a database, it may need to "query" its database. The retail company may want to find data about, for example, the names of all employees working in a specific store, the names of all employees working on a specific date, all transactions made for a specific product within a specific time frame, and so on.

[0007] When a retail store wants to query its database to extract some organized information from the database, a query statement is executed against the database data. The query returns specific data based on one or more query predicates, which indicate what information the query should return. The query extracts specific data from the database and formats the data into a readable form. The query can be written in a language that the database understands, such as Structured Query Language ("SQL"), so that the database system can determine what data should be located and how the data should be returned. The query can request any relevant information stored within the database. If the appropriate data can be found to respond to the query, the database has the potential to reveal complex trends and activities. This power can only be exploited by using successfully executed queries.

[0008] Traditional database management requires companies to provide infrastructure and resources to manage databases in data centers. The management of traditional databases can be very expensive and requires oversight by multiple people with extensive technical skills. Traditional relational database management systems (RDMS) require a lot of computing and storage resources and have limited scalability. Large amounts of data can be stored across multiple computing devices. Servers can manage data so that it is accessible to customers through internal operations. For an entity that wishes to have an internal database server, the entity must spend a lot of resources on capital investment in hardware and infrastructure for the database and a lot of physical space for storing the database infrastructure. In addition, in the event of a power outage or other disaster, the database may be extremely vulnerable to data loss. Such traditional database systems have significant drawbacks that can be mitigated by cloud-based database systems.

[0009] Cloud database systems can be deployed and delivered through a cloud platform that allows organizations and end users to store, manage, and retrieve data from the cloud. Some cloud database systems include a traditional database architecture that is implemented by installing database software on top of a computing cloud. The database can be accessed through a web browser or application programming interface (API) for application and service integration. Some cloud database systems are operated by a vendor who directly manages the back-end processes of database installation, deployment, and resource allocation tasks on behalf of the client. The client can have multiple end users who access the database through a web browser and / or API. Cloud databases can bring significant benefits to some clients by mitigating the risk of losing database data and allowing multiple users across multiple geographic regions to access data.

[0010] There are multiple architectures for both traditional database systems and cloud database systems. One example architecture is a shared disk system. In a shared disk system, all data is stored on a shared storage device that is accessible from all processing nodes in the data cluster. In this type of system, all data changes are written to the shared storage device to ensure that all processing nodes in the data cluster access a consistent version of the data. As the number of processing nodes in a shared disk system increases, the shared storage device (and the communication links between the processing nodes and the shared storage device) becomes a bottleneck, slowing down data read and write operations. Adding more processing nodes further exacerbates this bottleneck. Therefore, the scalability of existing shared disk systems is limited due to this bottleneck problem.

[0011] In some cases, access to additional data stored outside a central database or a master database may be beneficial. In an example, a database user may store its data on its own internal system and / or a cloud-based database account. A database user may wish to access its own data, or may wish to access additional data that is not stored in the database user's internal system and / or a cloud-based database account. The additional data may be referred to as external data. In some cases, a database user may benefit from collaboratively querying its own data and external data, or comparing its own data and external data, or modifying its own data according to changes made to external data, and so on. External data may be stored in one or more external tables. An external table represents content that is not directly managed by a database. There are some database structures and file formats that are created to speed up query response time and / or reduce the computational load of executing database queries. One such database structure is a materialized view. Materialized views improve the performance of expensive database queries by instantiating and reusing common intermediate query results in workloads. A materialized view is a database object that includes the results of a database query and can improve the performance of a database query by caching the results of a query. Materialized views can be expensive to update and maintain, making effective use of materialized views difficult.

[0012] The present invention discloses a system, method and device for maintaining, updating and querying an external table in a database system, and further discloses a system, method and device for generating and refreshing a materialized view according to an external table in a database system. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Non-limiting and non-exhaustive embodiments of the present disclosure are described with reference to the following drawings, wherein like reference numerals refer to the same or similar parts throughout the various views unless otherwise specified. The advantages of the present disclosure will be better understood with respect to the following description and drawings, wherein:

[0015] Figure 1 is a schematic block diagram illustrating a system for generating a materialized view on an external table according to one embodiment;

[0016] Figure 2 is a schematic block diagram showing a processing flow involving an external data manager according to one embodiment;

[0017] Figure 3 is a schematic diagram of a data processing platform according to one embodiment;

[0018] Figure 4 is a block diagram of a resource manager according to one embodiment;

[0019] Figure 5 is a block diagram of an execution platform according to one embodiment;

[0020] Figure 6 is a block diagram of an external data manager according to one embodiment;

[0021] Figure 7 is a block diagram of a process flow for querying an external table according to one embodiment;

[0022] Figure 8 is a block diagram of a process flow for incremental updates of materialized views according to one embodiment;

[0023] Fig. 9 is a block diagram of a process flow for updating a materialized view based on an external table according to one embodiment;

[0024] Fig.10 is a schematic diagram of a data structure for storing data and metadata in a database system according to one embodiment;

[0025] Figures 11A-11C is a schematic diagram of a data structure for versioning and refreshing data and metadata in a database system according to one embodiment;

[0026] Fig.12 is a schematic flow chart of a method for automatically maintaining an external table in a database system according to one embodiment;

[0027] Fig.13 is a schematic flow chart of a method for defining an external table in a database system according to one embodiment;

[0028] Fig.14 is a schematic flow chart of a method for querying an external table in a database system according to one embodiment;

[0029] Fig.15is a schematic flow chart of a method for generating a materialized view based on an external table in a database system according to one embodiment;

[0030] Fig.16 is a schematic flow chart of a method for querying an external table in a database system according to one embodiment; and

[0031] Fig.17 is a schematic diagram of an example computing device according to one embodiment.

[0032] Detailed Description

[0033] The systems, methods, and devices of the present disclosure are directed to external tables in a database system. In an embodiment, the database system includes a multi-tenant and cloud-based database platform that enables clients (i.e., accounts associated with the database platform) to ingest data into the database platform, store data in the database platform, and query data in the database platform. In some cases, clients of the database platform may wish to query or analyze data that is stored outside the database platform and is not directly managed by the database platform. Such data may be referred to herein as "external data" or "external tables."

[0034] In an embodiment, the database platform is used as a cloud data warehouse. Data can be stored across the shared storage devices of the database platform and can be organized and managed by the database platform. In an embodiment, structured data or semi-structured data can be copied into a data bucket that communicates with the database platform. The data in the data bucket can be ingested by the database platform and then organized and managed by the database platform. Clients can then view and query such data.

[0035] However, in some cases, the client may not want to ingest data into the database platform, or may want to ingest only a portion of the data into the database platform. In this case, the client can greatly benefit from reading external data and performing queries on external data through the database platform. External data is not directly managed by the database platform, but the database platform can still query external data, generate metadata about external data, generate materialized views about external data, generate change tracking information about external data, and so on.

[0036] In an embodiment, a data lake is associated with a database platform, and a client loads new data into the data lake. When data is loaded into the data lake or when data in the data lake is modified or updated, the database platform is notified. The database platform generates external tables based on the database platform, and further generates and stores metadata about the data in the external tables. The database platform can generate materialized views based on the external tables and / or execute queries on the external tables.

[0037] The above embodiments provide obvious benefits for clients who do not want to ingest data into a database platform but still want to perform operations on data by using a database platform. In the example, the client uses an external data storage platform as its data lake. In the example, the external data storage platform is a cloud-based storage in which data including photos, videos, documents, tables, and other files can be uploaded and stored. In an embodiment, the external data storage platform is a storage service referred to as a "data bucket" in some cases. In the example, the client has used the external data storage platform as its data lake and wants to treat the external data storage platform as the only true source of its data. The client does not want to copy any data into the database platform. According to the systems, methods, and devices described herein, the client can still enjoy the benefits of using a database platform without ingesting data into the database platform. The client can create an external table based on a selection of files in a data bucket or based on all files in a data bucket. The external table can be provided to the database platform in a read-only manner so that the external table is not managed or manipulated by the database platform. According to the embodiments disclosed herein, the client can use the database platform to generate and update metadata about the data in the external table, query the external table, and generate materialized views based on the external table.

[0038] In another example, the client wants to use a mixture of internal and external data with respect to the database platform. The client may want to store the first part of its data in a data bucket with an external data storage platform, so that the data bucket acts as a client data lake for the first part of its data. The client may want to store raw data (such as images, videos, unpartitioned tables, and other files) in a data bucket (serving as the client's data lake). The client may also want to store the second part of its data in the database platform, so that the database platform acts as the client's data warehouse. The data stored in the data warehouse (i.e., managed by the database platform) is collated and organized to enable high-granularity queries, complex change tracking, and fine-tuned analysis. In this example, the client may be motivated to store its data in two locations for a variety of reasons. One such reason is that the client may run a program or application that prefers to access data from a data lake rather than a data warehouse or may not be able to access data from a data warehouse in some cases. Another reason may be that the database platform cannot process the raw data stored in the data bucket. Another such reason may be that certain types of data (e.g., application logs of data-based events or actions in a system, network, or information technology environment) are frequently generated and rarely analyzed. A client may find it inefficient to maintain a data ingestion pipeline with a database warehouse for application logs or other data that is unlikely to be queried frequently. Another reason may be that the client does not want certain data to be outside of its virtual private cloud for security reasons. Another reason may be that the client requires specific data sets to expire after a set amount of time, and it may be challenging to purge these data sets from the database warehouse. Another reason may be that the client wants to use an open file format (such as Apache Parquet) so that other applications can access the data directly without accessing the data warehouse.

[0039] The above examples illustrate the benefits of the systems, methods, and devices described herein for maintaining and querying external tables. The described systems, methods, and devices enable a database platform to generate metadata about external data that is stored externally to and not managed by the database platform. Additionally, the systems, methods, and devices described herein enable a database platform to query external data based on metadata stored internally by the database platform. Additionally, the systems, methods, and devices described herein enable a database platform to generate materialized views based on external data and refresh those materialized views in response to changes to the external data.

[0040] In an embodiment, a method for maintaining an external table in a database system is disclosed. The method includes receiving, by a database platform, read access to content stored in a data storage platform separate from the database platform. The method includes defining an external table based on the content stored in the data storage platform. The method includes connecting the database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The method includes generating metadata for the external table, the metadata including information about the data stored in the external table. The method includes receiving a notification of a modification to the content of the data storage platform, the modification including one or more of an insert, a delete, or an update. The method includes refreshing the metadata of the external table in response to the modification to the content of the data storage platform.

[0041] In an embodiment, a method for querying an external table is disclosed. The method includes connecting a database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The method includes receiving a query, the query being at least for data in the external table. The method includes determining one or more files in the external table that include data that satisfies a predicate based on metadata. The method includes pruning all files in the external table that do not include any data that satisfies the query condition based on the metadata. The method includes generating a query plan that includes a plurality of discrete subtasks. The method includes assigning the plurality of discrete subtasks to one or more nodes in the execution platform based on the metadata.

[0042] In an embodiment, a method for generating a materialized view from an external table is disclosed. The method includes connecting a database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The method includes generating, by the database platform, a materialized view from the external table. The method includes receiving a notification that a modification has been made to the external table, the modification including adding one or more new data to the external table or deleting or modifying existing data in the external table. The method includes refreshing the materialized view in response to the external table being modified so that the materialized view includes an accurate representation of the external table.

[0043] Clients of the database platform may wish to store data in a data warehouse and / or a data lake. A data lake is a repository that can retain large amounts of raw data in its native format. A data lake can be used as a single store for all data for a client, ranging from raw data (which can be an exact copy of the source system data) to transformed data. The transformed data can be used for reporting, analysis, visualization, machine learning, and the like. A data lake can be suitable for storing large amounts of data that may never enter a data warehouse that manages, organizes, and queries it. A data lake can store raw, uncleaned data and can be optimized to allow clients to upload data in any format that is convenient for the client. In some embodiments, a data lake provides a file and file system abstraction that allows a large number of applications to operate on data.

[0044] A data warehouse can store cleansed data in a well-defined format. Data in a data warehouse can be organized and optimized for analysis to enable highly granular query and other processing. A data warehouse can include a relational schema and more constrained processing modes, so fewer applications can operate on data stored in a data warehouse than on data stored in a data lake.

[0045] In some cases, the maintenance cost of a data warehouse may be high. Clients of a database platform may wish to store a large amount of their data in a data lake and only store the collated and transformed data in a data warehouse. Embodiments of the present disclosure enable clients to store their data across a data lake and a data warehouse. In addition, embodiments of the present disclosure enable clients to store their data in a data lake and still be able to use a database platform to query and analyze the data in the data lake.

[0046] In some cases, it may be desirable to generate one or more materialized views based on external tables. This may be particularly beneficial if the client wishes to query data in external tables that are stored outside the database platform and not managed by the database platform. Since the external data is not managed by the database platform, accessing and / or reading the external data may be particularly difficult or inefficient. A materialized view is a database object that includes the results of a query. A materialized view may be a local copy of remotely located data, or may be a join result or a subset of rows and / or columns of a table, or may include summaries using aggregate functions. The process of generating a materialized view may be called instantiation. Instantiation is a form of caching the results of a query to a specific "instantiated" table that can be updated based on changes made to the original base table (in this case, the base table is an external table). Materialized views enable efficient access and reduce the time and amount of computing resources required to respond to queries. If the same query parameters are requested again, a materialized view may be referenced instead of the base table (i.e., the external table). Materialized views are managed by the database platform and can be read faster and more efficiently than the external storage where the external table is located.

[0047] In the example, the client wants to maintain all the data in the data lake outside the database platform. The client wants to use the database platform to analyze and query the data stored in the data lake. The database platform does not manage the data lake. According to the systems, methods, and devices disclosed herein, the client can create an external table stored in the data lake and accessible to the database platform. The database platform can generate one or more materialized views based on the external table, so that the one or more materialized views are stored, managed, and refreshed by the database platform. When the client sends a query request to the database platform, the database platform can respond to the query by reading the external table directly from the data lake. However, in order to reduce the time and amount of processing resources required to respond to the query, the database platform can instead respond to the query by referencing one or more materialized views generated based on the external table.

[0048] In an embodiment, and with further reference to the above example, the database platform responds to queries by referencing metadata about external tables. Metadata is generated, maintained, stored, and refreshed by the database platform. Metadata is information about data in external tables. Metadata includes information about how to store data in external tables. In an embodiment, the data in the external table (stored in the external storage platform) can be organized into a source directory hierarchy, where the leaves of the hierarchy are files. Each source directory may include one or more files, and the source directory may be modeled as a partition on the external table. The external table may include millions of rows of data and may be very large and difficult to store or read. In the example, the external table is divided into six different partitions, and each of the six partitions includes a portion of the data in the external table. Dividing the external table data into multiple partitions helps to organize the data and find the location of certain data in the table.

[0049] An analogy for a partition of an external table can be different storage buildings within a storage warehouse district. In this analogy, the storage warehouse district is analogous to the external table, and each individual storage building is analogous to a partition. There are hundreds or thousands of items stored throughout the storage warehouse district. Since there are so many items placed in the storage warehouse district, it makes sense to organize these items in multiple individual storage buildings. These items can be organized across multiple individual storage buildings in any way that makes sense. For example, one storage building can store clothing, another storage building can store household items, another storage building can store toys, and so on. Each storage building can be labeled to make it easier to find items. For example, if a person wants to find a stuffed bear, then he would know to go to the storage building where the toys are stored. The storage building where the toys are stored can be further organized into rows of shelves. The toy storage building can be organized so that all the stuffed animals are placed in one row of shelves. Therefore, a person looking for a stuffed bear may know to visit the building where the toys are stored, and may know to visit the row where the stuffed animals are stored. Further analogous to database technology, each row of shelves in the storage buildings of the storage warehouse district can be analogous to a column of database data within a partition of an external table. The labels for each storage building and each row of shelves are analogous to metadata in the context of a database.

[0050] Similar to the analogy of a storage warehouse area, the partitions disclosed herein can provide considerable benefits for managing data, finding data, and organizing data. Each partition organizes data into rows and columns and stores a portion of the data associated with an external table (or a database table stored and managed by a database platform). An external table or internal table may have many partitions. The division of database data between many partitions can be done in any way that makes sense for that type of data. For example, if the client is a credit card provider and the data is a credit card transaction, the table may include columns such as credit card number, account member name, merchant name, card transaction date, card transaction time, and the type of goods or services purchased with the card. The table may be stored in a data lake or data warehouse that is external to the database provider and not managed or updated by the database provider. The table may include millions of credit card transactions spanning an important time period, and each credit card transaction may be stored in a row of the table. Since the table includes millions of rows, the table may be divided into multiple partitions. In the case of credit card transactions, it may be beneficial to split the table based on time. For example, each partition may represent a credit card transaction for a day or a week. It should be understood that the table may be divided into partitions in any way that makes sense for the database client and the data type stored in the table. Partitioning provides significant benefits for managing the storage of millions of rows of data in a table and for finding certain information in a table.

[0051] A query can be performed on an external table or an internal table to find certain information in a table. In addition to the above example of a credit card transaction, a query can also seek to find all transactions for a certain seller within a specific period of time. For example, a client (in this case, a credit card provider) can send a query to a database provider and request a report on all credit transactions that occurred at retail store A in January, April, and May. In the example, these credit card transactions are stored in an external table that is not managed or updated by the database platform. In order to respond to the query, the resource manager of the database platform (see 302) must scan the external table to find each applicable credit card transaction. The external table may include millions of rows, which will be very time-consuming and require a large amount of computing resources to enable the resource manager to scan the entire external table. The partitioned organization disclosed herein and the system, method, and device for external table metadata storage provide significant benefits by shortening query response time and reducing the amount of computing resources required to respond to queries.

[0052] With further reference to the above example, a resource manager must respond to a query requesting all credit card transactions at retail store A in January, April, and May. The credit card transactions are stored in an external table that is not managed or updated by the database platform or the resource manager. The resource manager can find data units by scanning the external table metadata. The external table metadata includes information about the data stored in the external table, but the external table metadata is generated, stored, and refreshed by the database platform and is considered "internal" to the database platform. The multi-level database metadata described herein (see, e.g., Fig.10 ) enables the resource manager to quickly and efficiently find the right data to respond to the query. The resource manager can find the right table by scanning the cumulative table metadata of all multiple tables in the client database (see 1002). The resource manager can find the right grouping of partitions by scanning multiple grouping expression attributes on the identified table (see 1014a-1014d). The grouping expression attribute includes information about the data stored in each partition within the grouping. The resource manager can find the right partition by scanning multiple partition expression attributes within the identified grouping of the partition. The resource manager can find the right column by scanning one or more column expression attributes within the identified partition. The resource manager can find the right one or more rows by scanning the identified columns within the identified partition. Further referring to the example involving credit card transactions, the resource manager can scan multiple cumulative table metadata to find a table including credit card transactions. The resource manager can scan the grouping expression attributes to find groups with data for January, April, and / or May. For example, the resource manager finds a grouping including credit card transactions in January (and may further include transactions in other months). The resource manager reads the partition expression attribute of the grouping to find one or more separate partitions that include transactions for January. The resource manager reads the column expression attribute within each identified separate partition. The resource manager scans the identified columns to find applicable rows for credit card transactions for retail store A in January (or April or May). The metadata points the resource manager to the correct external table and the correct partition of the external table. The metadata can further point the resource manager to the correct row of the partition of the external table. By scanning the metadata stored inside the database platform, the resource manager can quickly find the storage location of the correct data in the external table.

[0053] As shown in the above examples, the metadata organization disclosed herein provides significant benefits to speed up query response time and enable resource managers to quickly identify the correct external table, the correct partition within the external table, and the correct columns and rows within the external table to respond to the query. The new metadata store as disclosed herein provides a multi-level metadata structure for maintaining information about partitions in external tables.

[0054] Before disclosing and describing methods, systems, and devices for performing operations on external tables by a database platform, it should be understood that the present disclosure is not limited to the configurations, processing steps, and materials disclosed herein, as such configurations, processing steps, and materials may vary somewhat. It should also be understood that the terms used herein are only used to describe the embodiments and are not intended to limit the scope of the present disclosure, as the scope of the present disclosure is limited only by the appended claims and their equivalents.

[0055] To provide additional background for the disclosure provided herein, a table (including an external table or an internal database table) is a collection of related data stored in a structured format and may include columns and rows. A table may be changed in response to a data manipulation (DML) command such as an insert command, a delete command, an update command, a merge command, etc. Such a modification may refer to a transaction occurring on a table. In an embodiment, each transaction includes a timestamp indicating when the transaction was received and / or when the transaction was fully executed. In an embodiment, a transaction includes multiple changes made to a table, and such changes may affect one or more partitions in the table. In an embodiment, data may be ingested continuously, or data may be ingested at determined time intervals, and ingesting data into a table is a transaction occurring on a table. In an embodiment, each time a transaction is executed on a table, a new table version including one or more new partitions is generated. In addition, each time a transaction is executed on a table, or after a threshold number of transactions are executed on a table, the metadata of the table may need to be updated to reflect the new or updated data stored in the table.

[0056] A table may store data in multiple partitions, where a partition is an immutable storage device. When a transaction is executed on such a table, all affected partitions are recreated to generate new partitions that reflect the modifications of the transaction. After the transaction is fully executed, all the original partitions that were recreated can be removed from the table. After each transaction is executed on a table, a new version of the table is generated. If the data in the table undergoes many changes (such as insertions, deletions, updates, and / or merges), the table may go through many versions over a period of time. Each version of the table may include metadata indicating what transaction generated the table, when the transaction was ordered, when the transaction was fully executed, and how the transaction changed one or more rows in the table. The disclosed system, method, and device for low-cost table versioning can be used to provide an effective device for updating table metadata after one or more changes (transactions) occur on the table. Such a system, method, and device can be implemented to generate metadata stored inside a database platform, wherein the metadata includes information about data stored in external tables that are not managed or updated by the database platform.

[0057] In one embodiment, the metadata is stored and maintained on non-mutable storage services (which may be referred to herein as micro-partitions) in the cloud. These storage services may include, for example, Amazon Microsoft Azure Blob and Google Cloud Many of these services do not allow data to be updated in place (i.e., non-mutable or immutable). Data micro-partitions can only be added or deleted, not updated. In one embodiment, storing and maintaining metadata on these services requires adding a metadata partition to the storage service for each change in the metadata. These metadata micro-partitions can be periodically merged in the background into larger "compacted" or merged metadata micro-partitions.

[0058] In an embodiment, all data in a table is automatically divided into immutable storage devices called micro-partitions. Micro-partitions can be considered as batch processing units, where each partition has a continuous storage unit. For example, each micro-partition can contain between 50MB and 500MB of uncompressed data (note that the actual size in storage may be smaller because the data may be compressed and stored). Groups of rows in a table can be mapped to separate partitions organized in a column manner. This size and structure allow for extremely fine-grained selection of partitions to be scanned, which can include millions or even hundreds of millions of micro-partitions. This granular selection process may be referred to herein as metadata-based "pruning". Pruning involves using metadata to determine which parts of a table (including which micro-partitions or micro-partition groups in a table) are irrelevant to a query, and then avoiding those irrelevant micro-partitions when responding to the query and scanning only relevant micro-partitions in response to the query. Metadata about all rows stored in a micro-partition can be automatically collected, including: the value range of each column in the micro-partition; the number of distinct values; and / or other attributes for optimized and efficient query processing. In one embodiment, partitioning can be automatically performed on all tables. For example, a table can be transparently partitioned using the order in which insertion / loading of data occurs.

[0059] In describing and claiming the present disclosure, the following terminology will be used in accordance with the definitions set forth below.

[0060] It must be noted that, as used in this specification and the appended claims, the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise.

[0061] As used herein, the terms "comprising," "including," "comprising," "characterized by," and grammatical equivalents thereof are inclusive or open-ended terms that do not exclude additional, unrecited elements or method steps.

[0062] As used herein, a database table is a collection of records (rows). Each record contains a collection of values ​​for table attributes (columns). Database tables are typically physically stored in multiple smaller (variable or fixed size) storage units, such as files or blocks.

[0063] A detailed description of systems and methods consistent with various embodiments of the present disclosure is provided below. Although several embodiments are described, it should be understood that the present disclosure is not limited to any one embodiment, but includes many alternatives, modifications, and equivalents. In addition, although many specific details are set forth in the following description to provide a thorough understanding of the embodiments disclosed herein, some embodiments may be implemented without some or all of these details. In addition, for the sake of clarity, certain technical materials known in the prior art are not described in detail to avoid unnecessarily obscuring the present disclosure.

[0064] Now referring to the accompanying drawings, Figure 1 A schematic block diagram of a system 100 for generating, refreshing, and querying external tables is shown. The system 100 includes a database platform 102. The database platform 102 may be a cloud-based database computing platform for storing, organizing, maintaining, and querying database data. The database platform 102 may communicate with multiple client accounts. Embodiments of the database platform 102 include Figure 3 The system 300 is shown. The database platform 102 communicates with the data lake 104 that receives data from the clients 118. The data lake 104 may include a cloud-based data storage resource that can receive files and raw data in its native format.

[0065] The external table 106 may be generated based on the data within the data lake 104. The external table 106 includes structured or semi-structured data. The external table 106 is accessible to the database platform 102, but is not managed or updated by the database platform 102. In an embodiment, the external table 106 is stored within the data lake 104, and the structure and organization of the external table 106 is defined by the client 118. In an embodiment, the structure and organization of the external table 106 is defined by the database platform 102. The data lake 104 includes storage of data managed by the client 118, wherein the client 118 is associated with the data lake 104 and the database platform 102. The data lake 104 may be external to the database platform 102, such that the database platform 102 does not have the ability or authorization to write or manipulate data within the data lake 104. The database platform 102 may have permission to read data stored in the data lake 104, query data stored in the data lake 104, and / or receive instructions when the data lake 104 is updated.

[0066] In an embodiment, the external table 106 is generated based on a source directory in the data lake 104. The source directory in the data lake 104 may alternatively be referred to as a namespace or source file. The client 118 may identify the source directory, and the client may manually indicate that new data should be uploaded to the source directory. The data lake 104 is a system or repository for data. The data within the data lake 104 may be stored in a structured or unstructured state at any scale. The data may be stored as is without first structuring the data. In an embodiment, the data lake 104 is a single store for all enterprise data of the client 118, including a raw copy of the source system data and transformed data that can be used for tasks such as reporting, visualization, analysis, machine learning, etc. In an embodiment, the data lake 104 includes structured data (i.e., rows and columns) from a relational database, semi-structured data, unstructured data (e.g., emails, documents, etc.), and binary data (e.g., images, audio, video, etc.). The data lake 104 can manage big data for the client 118 by providing a single point for collecting, organizing, and sharing data.

[0067] Data lake 104 can be distinguished from a data warehouse. However, in some embodiments, a data warehouse can be utilized instead of a data warehouse. Figure 1 . The data lake 104 is shown in . The data warehouse includes a database optimized to analyze relational data from transactional systems and line-of-business applications. In the data warehouse, data structures and schemas can be predefined to optimize for fast queries. The data in the data warehouse can be cleaned, enriched, and transformed to act as a single source of truth. The data lake 104 can store relational data from line-of-business applications and non-relational data from, for example, mobile applications, IoT devices, and social media. In the data lake 104, the structure or schema of the data may not be defined when the data is captured, so that all data can be stored without careful design. In some embodiments, it may be beneficial to use both a data warehouse and a data lake, and as disclosed herein, such embodiments may benefit from systems, methods, and devices for generating materialized views based on external tables.

[0068] The data lake 104 can import any amount of new data 108 that can be ingested in real time. New data 108 can be collected from multiple sources and moved to the data lake 104 in its original format. This process can allow the data lake 104 to scale to any size of data while saving time defining data structures, schemas, and transformations. The data lake 104 can provide the ability to understand what data is stored in the data lake 104 by crawling, classifying, and indexing the data. The data within the data lake 104 can be secured and encrypted to ensure that the data is protected.

[0069] Data lake 104 provides a catalog for external tables 106 and materialized views 116. The catalog may be stored in a different file format than the tables stored in the shared storage device of database platform 102. The catalog of data lake 104 may be stored in a cloud storage system, such as Amazon Web Services TM 、Microsoft Azure TM The data lake 104 may be independent and separate from the database platform 102 (see, e.g. Figure 3-5 ).

[0070] The client 118 may add new data 108 to the data lake 104. The new data 108 may be in any file format. In an embodiment, the new data 108 must be in a specific file format to be read by the database platform 102 or merged into the external table 106. In an embodiment, the database platform 102 includes a shared storage device for storing database data (which data may be referred to as "internal" data managed by the database platform 102). The client 118 may have data stored in the data lake 104, and may further have different or replicated data stored in the shared storage device of the database platform 102. In an embodiment, the data stored in the data lake 104 and the data stored in the shared storage device of the database platform 102 have different file formats. In such an embodiment, the database platform 102 may be configured to read data of different formats stored in the data lake 104 and / or convert those different formats to the same data format used by the database platform 102.

[0071] When new data 108 is added to the data lake 104, a notification 110 is generated and provided to the ingestion service 112 of the database platform 102. The notification 110 includes an indication that the new data 108 has been added to the data lake 104. The notification 110 may be automatically generated by the data lake 104, may be automatically or manually generated by a client, may be automatically or manually retrieved by the database platform 102, and the like. In an embodiment, the database platform 102 queries the data lake 104 at a threshold period to determine whether the new data 108 has been added to the data lake 104. In an embodiment, the notification 110 is provided to the ingestion service 112 to indicate that the data lake 104 has received the new data 108. The ingestion service 112 may prompt updates to the external tables 106 and further to the materialized views 116 based on the new data 108.

[0072] The ingestion service 112 receives notifications from the data lake 104 that updates have been made to data stored within the data lake 104. The ingestion service 112 may receive notifications that data within a source directory (which may alternatively be referred to as a namespace or source file) in the data lake has been updated. The ingestion service 112 updates the metadata of the external table 106 to reflect any modifications made to the data lake 104 data.

[0073] The new data 108 is read and / or retrieved by the ingestion service 112 of the database platform 102. The new data 108 is stored in the external table 106. The external table can communicate with the database platform 102, but may not be managed by the database platform. In an embodiment, the database platform 102 can read the data in the external table 106, but cannot write data to the external table 106. In an embodiment, the client 118 manages the external table 106 and provides access to the external table 106 to the database platform 102. In an embodiment, the external table 106 is managed and / or provided by a cloud-based data warehouse service, which may be independent and separate from the database platform 102. When the new data 108 is added to the data lake 104, the external table 106 is updated to reflect the new data 108.

[0074] The database platform 102 can generate one or more materialized views 116 based on the external tables 106. The materialized views 116 of the external tables 106 can be managed by the database platform 102 and can be stored in a plurality of shared storage devices associated with the database platform 102 (see, e.g., 308). When new data 108 is added to the data lake 104, the external tables 106 are updated and the materialized views 116 of the external tables 106 are refreshed.

[0075] The database platform 102 generates a materialized view 116 based on the external table 106. The generation of the materialized view 116 based on the external table 106 can be decomposed into two steps. In the first step, a non-materialized external table is generated. In the second step, a materialized view is generated based on the non-materialized external table. In certain embodiments, as disclosed herein, it may be beneficial to decompose a non-materialized external table from a materialized view. The decomposition may allow multiple different materialized views to be generated, and each of the multiple materialized views may include a different selection of data, a different projection, a different summary, etc., without first instantiating all the source data.

[0076] The combination of unmaterialized external tables 106 and materialized views 116 of external tables 106 may be beneficial in implementations where a large amount of data is already stored in data lake 104 and only a recent subset of that data is frequently queried. In such implementations, materializing all of the data in data lake 104 may be cost-prohibitive. Additionally, generating materialized views from external tables may allow only the most frequently queried portions of data in data lake 104 to be materialized.

[0077] The metadata component 114 generates and refreshes metadata based on the data in the data lake 104 and / or the external table 106. The metadata is generated, managed, stored, and refreshed by the database platform 102. Metadata is information about the data stored in the data lake 104 and / or the external table 106. Fig.10 and Figures 11A-11C The metadata includes information about the data stored in the data lake 104 and / or the external table 106, so that the resource manager (see, for example, 302) of the database platform 102 can perform queries on the external table 106 without having to read all the data in the external table.

[0078] The metadata component 114 further generates and refreshes metadata about the materialized view 116. When the data lake 104 and / or the external table 106 are updated, the materialized view 116 can be refreshed to reflect the updates. The metadata component 114 can further refresh the metadata to reflect the updates made to the materialized view 116. When the client 118 queries the external table 106, if there is a materialized view 116 that can respond to the query, the resource manager (see 302) of the database platform 102 can execute the query on the materialized view 116. When the query is executed on the materialized view 116 rather than on the external table 106 itself, the database platform 102 spends less time and processing resources.

[0079] In an embodiment, the data in the external table 106 is organized into partitions that constitute an immutable storage device. In an embodiment, the data in the external table 106 is organized into a mutable storage device that can be updated in place, but the database platform 102 interacts with the external table 106 as if the data cannot be updated in place. The data in the external table 106 can be stored in a file format that is different from those file formats that are typically used for internal data associated with the database platform. The resource manager 302 of the database platform 102 can scan the metadata to determine which partitions in the external table 106 need to be used to respond to the query.

[0080] In an embodiment, the client 118 issues a command to the database platform to create an external table 106, and the command does not define a schema for the external table 106. In such an embodiment, the external table 106 is generated without a schema defined with the table definition. The external table 106 may include variable columns, and all data in the external table 106 may be queried using smart columns.

[0081] The client 118 can query the external table 106 metadata by various methods. In an embodiment, a view shows all external tables in the database. The columns in such a result are similar to those of a regular table, while the external table 106 will have additional columns. In an embodiment, the external table 106 includes a notification channel column that specifies the resource name of a Simple Queue Service (SQS) queue created in the backend so that the client account can set up automatic addition of files to the external table 106. In an embodiment, the external table 106 includes a location column that specifies the location where the external table 106 is configured.

[0082] The metadata view indicates the directories that contribute data to the external table 106. In the case where the data source is a data lake 104, new files can be added at any time, old files can be deleted at any time, and files can be updated at any time. In such an embodiment, it may be beneficial to generate a metadata view of all files that contribute data to the external table 106. In an embodiment, all directories of the external table 106 are tracked, and such data is available for viewing in the information schema. Directories that are deregistered or deleted can be removed from the metadata view.

[0083] Materialized views 116 may be generated from external tables 106 to provide faster query response times. Materialized views 116 may be automatically and incrementally updated to ensure that data is always synchronized with a primary source of truth, such as a source catalog in data lake 104. Fast queries 116 may be processed against materialized views 116 to improve query response times for frequently used data.

[0084] Figure 2 is a schematic block diagram of a process flow 200 for managing external tables in a database platform 102. The system 200 includes a database platform 102 in communication with a data lake 204 and a client 218. As disclosed herein, the database platform 102 can be incorporated into a resource manager (see, e.g., 302) of the database platform 102.

[0085] Client 218 communicates with data lake 204, which is managed by or connected to client 218 and is external to database platform 102. In an embodiment, database platform 102 communicates with data lake 204 so that database platform 102 can read data written to data lake 204, but cannot write data to data lake 204. Database platform 102 can be incorporated into a cloud-based database computing platform, and data lake 204 can constitute a separate and independent cloud-based storage structure.

[0086] In process flow 200, client 218 adds data to data lake 204. Notification listener component 220 receives an indication that data has been added to data lake 204. Notifications can be automatically or manually generated by data lake 204 or client 218. Notification listener component 220 provides an indication to external table refresh component 222 that data has been added to data lake 204 and that the external table should be refreshed or updated to reflect the new data added to data lake 204. Notification listener component 220 can communicate with a source table in data lake 204 that serves as a source table for an external table that can be queried by database platform 102. Client 218 can define source tables in data lake 208, and notification listener component 220 can receive notifications whenever data is added to or updated in the source table.

[0087] The external table refresh component 222 refreshes an external table readable by the database platform 102. In an embodiment, the database platform 102 is a component of a cloud-based database computing platform that organizes database data (managed and stored by the cloud-based database computing platform) into immutable storage devices referred to herein as partitions. In such an embodiment, data added to the data lake 204 may not be organized into partitions. The external table refresh component 222 may specify one or more partitions for an external table based on new data added to the data lake 204. In an embodiment, the data in the data lake 204 has a different file format than the internal data managed by the cloud-based database platform. The external table refresh component 222 can be configured to read and understand multiple file formats and convert the data to the same file format used by the cloud-based database platform.

[0088] The metadata component 224 generates, organizes, and stores metadata about the data stored in the external table. The metadata is based on the partitions for the external data specified by the external table refresh component 222. An example structure of the metadata can be found at Fig.10 and Figures 11A-11C. In an embodiment, client 218 specifies a hierarchical structure for the data within the external table. Client 218 may specify how folders and subfolders will be organized for the external data, how the data will be divided into rows and columns, and / or how the external data will be divided into partitions. In an example, client 218 may store insurance information in an external table. In this example, client 218 may specify that data should be organized with separate columns for the year, month, day, and time of the insurance transaction. Client 218 may specify that insurance transactions should be organized by location so that each state or region is stored in a different partition. In an embodiment, client 218 uploads a file to a specific folder in data lake 204, and the location of the file guides metadata component 224 to generate the correct metadata for the file.

[0089] In an embodiment, metadata component 224 generates change tracking metadata for a partition in an external table that has been modified. Notification listener component 220 can receive an indication that a file in data lake 204 has been modified. A subfolder within a source directory can provide data for a partition in an external table. Based on the notification, the database platform can update metadata about the external table.

[0090] The materialized view refresh component 226 updates the materialized view generated from the external table. The materialized view can be stored and managed by a cloud-based database computing platform separate from the data lake 204. The materialized view is refreshed to reflect any new data added to the data lake 204 and / or to reflect any updates (such as merges or deletes) made to the external data.

[0091] The external table generation component 228 generates an external table based on the data in the data lake 204. The external table can be defined by the external table generation component 228 or the client 218. In an embodiment, the client 218 provides the database platform 102 with access to the source catalog in the data lake 204 and indicates that the external table should be generated based on the source catalog.

[0092] In an embodiment, the client 218 provides an indication of a hierarchical structure in the source directory, wherein the hierarchical structure may have been manually defined by the client 218. The hierarchical structure may indicate the organization of data in the source directory, including folders and subfolders of the data. In an example, the client 218 may indicate that a folder includes all credit card transactions in 2019. The client 218 may further indicate that a first subfolder includes all credit card transactions in January 2019, a second subfolder includes all credit card transactions in February 2019, and so on. The client may further provide an indication of a partition structure of an external table based on the source directory. The partition structure may indicate how the data in the external table should be organized into columns, rows, and partitions. The external table generation component 228 may define an external table based on the hierarchical structure, the partition structure, and the location where the file is uploaded within the folders and subfolders of the hierarchical structure.

[0093] In the example, the client 218 indicates that the partitions in the external table should be organized based on location, such that all credit card transactions in California are in one partition, all credit card transactions in Maine are in a different partition, and so on. The client 218 can further indicate that the partitions in the external table should be further organized based on the timestamp of the credit card transaction. The client can upload credit card transactions for California in April 2019 in a California folder, a California 2019 subfolder, and further in a California April 2019 subfolder. Based on the hierarchical structure and the partition structure, the external table generation component 228 defines a partition in the external table that includes data for credit card transactions in California in April 2019.

[0094] Folders and subfolders can be stacked in the source directory of the data lake and can be defined by the client. When data is uploaded to a subfolder in the source directory, the external table generation component 228 defines the external table based on the location where the data is uploaded in the context of the hierarchical structure and partition structure defined by the client.

[0095] The query component 230 receives a query from the client 218. The query component 230 scans the metadata to determine one or more partitions necessary to respond to the query. In an embodiment, at least one of the one or more partitions is stored in an external table that is not managed or stored by the cloud-based database computing platform. The query component 230 parses the execution of the query into multiple discrete subtasks and assigns the discrete subtasks to multiple nodes of the execution platform. The execution platform executes the query.

[0096] The security component 232 manages permissions to external tables. When the database platform 102 has permission to view data in an external table, the query component 218 can access the data to respond to a query.

[0097] Reference now Figure 3 , shows a data processing platform 300 for running the methods and systems disclosed herein. Figure 3 As shown, resource manager 302 can be coupled to multiple client accounts 314a, 314b, and 314n. Client accounts 314a, 314b, and 314n can represent different clients, such as Figure 1 Client 118 is shown. In particular embodiments, resource manager 302 can support any number of client accounts that wish to access execution platform 304 and / or shared database storage 308. Client accounts 314a, 314b, and 314n can include, for example, end users providing user files to be ingested into the database, data storage and retrieval requests, system administrators administering the systems and methods described herein, and other components / devices that interact with resource manager 302.

[0098] The resource manager 302 provides various services and functions that support the operation of all systems and components within the data processing platform 300. The resource manager 302 can be coupled to shared metadata 312, which is associated with all data stored throughout the data processing platform 300. The shared metadata 312 includes metadata for data stored in the shared database storage 308, and further includes metadata for data stored in external tables (see 106). In some embodiments, the shared metadata 312 includes a summary of the data stored in the remote data storage system and the data available from the local cache. In addition, the shared metadata 312 may include information about how the data is organized in the remote data storage system and the local cache. The shared metadata 312 may allow systems and services to determine whether a data segment needs to be processed without having to load or access the actual data from the storage device. It can be based on Fig.10 and Figures 11A-11C The shared metadata 312 is organized using the metadata structure shown.

[0099] The resource manager 302 may be further coupled to an execution platform 304 that provides a plurality of computing resources for performing various data storage and data retrieval tasks, as discussed in more detail below. The execution platform 304 includes a plurality of execution nodes 306a, 306b, 306c, and 306n that are configured to handle various tasks associated with a database, including ingesting new user files and generating one or more partitions for a table (which may be an external table or a table stored in a shared database storage 308) based on the new user files. The execution platform 304 may be coupled to a shared database storage 308 that includes a plurality of data storage devices 310a, 310b, 310c, and 310n. In some embodiments, the shared database storage 308 includes a cloud-based storage device located in one or more geographic locations. For example, the shared database storage 308 may be part of a public cloud infrastructure or a private cloud infrastructure. The shared database storage 308 may include a hard disk drive (HDD), a solid state drive (SSD), a storage cluster, or any other data storage technology. In addition, the shared database storage 308 may include a distributed file system (such as a Hadoop distributed file system (HDFS)), an object storage system, etc. It should be understood that the shared database storage 308 can be accessed by one or more instances of the resource manager 302, but may not be accessed by all client accounts 314a-314n. In an embodiment, a single instance of the resource manager 302 is shared by multiple client accounts 314a-314n. In an embodiment, each client account 314a-314n has its own resource manager and / or its own shared database storage 308 shared between multiple execution nodes 306a-306n of the execution platform 304. In an embodiment, the resource manager 302 is responsible for providing access to specific data within the shared database storage 308 to specific client accounts 314a-314n.

[0100] In certain embodiments, the communication links between resource manager 302 and client accounts 314a-314n, shared metadata 312, and execution platform 304 are implemented via one or more data communication networks. Similarly, the communication link between execution platform 304 and shared database storage 308 is implemented via one or more data communication networks. These data communication networks can utilize any communication protocol and any type of communication medium. In some embodiments, the data communication network is a combination of two or more data communication networks (or subnetworks) coupled to each other. In alternative embodiments, these communication links are implemented using any type of communication medium and any communication protocol.

[0101] like Figure 3As shown, data storage devices 310a-310n are separated from computing resources associated with execution platform 304. The architecture supports dynamic changes to data processing platform 300 based on changing data storage / retrieval needs and changing needs of users and systems accessing data processing platform 300. The architecture enables execution platform 304 and shared database storage 308 to be effectively infinitely scalable. Support for dynamic changes allows data processing platform 300 to expand rapidly in response to changing needs for systems and components within data processing platform 300. The separation of computing resources from data storage devices supports the storage of large amounts of data without requiring a corresponding large amount of computing resources. Similarly, this separation of resources supports a significant increase in computing resources used at a particular time without a corresponding increase in available data storage resources.

[0102] Resource manager 302, shared metadata 312, execution platform 304 and shared database storage 308 are in Figure 3 304 and 314. However, each of the resource manager 302, shared metadata 312, execution platform 304, and shared database storage 308 can be implemented as a distributed system (e.g., distributed in multiple systems / platforms at multiple geographic locations). In addition, each of the resource manager 302, shared metadata 312, execution platform 304, and shared database storage 308 can be expanded or reduced (independently of each other) based on changes to requests received from client accounts 314a-314n and changes in the data processing platform 300. Therefore, the data processing platform 300 is dynamic and supports regular changes to meet current data processing needs.

[0103] Figure 4 is a block diagram depicting an embodiment of the resource manager 302. Figure 4 As shown, resource manager 302 includes access manager 402 and key manager 404 coupled to data storage device 406. Access manager 402 can handle authentication and authorization tasks for the system described herein. Key manager 404 can manage the storage and authentication of keys used during authentication and authorization tasks. Request processing service 408 manages received data storage requests and data retrieval requests. Management console service 410 supports administrators and other system managers' access to various systems and processes.

[0104] The resource manager 302 may also include a job compiler 412, a job optimizer 414, and a job executor 416. The job compiler 412 parses tasks such as ingestion tasks and generates execution code for ingesting user files. The job optimizer 414 determines the best method to execute the ingestion task based on the data that needs to be processed and / or ingested. The job executor 416 executes the code for the ingestion task received by the resource manager 302. The job scheduler and coordinator 418 can send the received user files to the appropriate service or system for compilation, optimization, and dispatch to the execution platform 304. The virtual warehouse manager 420 manages the operation of multiple virtual warehouses implemented in the execution platform.

[0105] In addition, the resource manager 302 includes a configuration and metadata manager 422 that manages information about data stored in remote data storage devices and in local caches. A monitor and workload analyzer 424 oversees the processes executed by the resource manager 302 and manages the distribution of tasks (e.g., workloads) among virtual warehouses and execution nodes in the execution platform. The configuration and metadata manager 422 and the monitor and workload analyzer 424 are coupled to a data storage device 426.

[0106] Resource manager 302 includes Figure 2 The database platform 102 is shown. The database platform 102 manages the interaction between the database platform 102 and the external table 106. The external table can include data stored in the source table of the data lake 104.

[0107] Figure 5 is a block diagram depicting an embodiment of the execution platform 304. Figure 5 As shown, the execution platform 304 includes multiple virtual warehouses, including virtual warehouse 1, virtual warehouse 2, and virtual warehouse n. Each virtual warehouse includes multiple execution nodes, and each execution node includes a data cache and a processor. The virtual warehouse can execute multiple tasks in parallel by using multiple execution nodes. As discussed herein, the execution platform 304 can add new virtual warehouses and discard existing virtual warehouses in real time based on the current processing needs of the system and users. This flexibility allows the execution platform 304 to quickly deploy large amounts of computing resources when needed without having to continue paying for those computing resources when they are no longer needed. All virtual warehouses can access data from any data storage device (e.g., any storage device in the shared database storage 308). Although Figure 5 Each virtual warehouse shown in includes three execution nodes, but a particular virtual warehouse may include any number of execution nodes. In addition, the number of execution nodes in a virtual warehouse is dynamic, so that new execution nodes are created when there is additional demand, and existing execution nodes are deleted when they are no longer needed.

[0108] Each virtual warehouse has access to Figure 3 Thus, a virtual warehouse need not be assigned to a specific data storage device, but can access data from any data storage device 310a-310n within the shared database storage 308. Similarly, Figure 5 Each execution node shown in can access data from any data storage device 310a-310n. In some embodiments, a specific virtual warehouse or a specific execution node can be temporarily assigned to a specific data storage device, but the virtual warehouse or execution node can access data from any other data storage device later.

[0109] exist Figure 5 In the example of , virtual warehouse 1 includes three execution nodes 502a, 502b and 502n. Execution node 502a includes cache 504b and processor 506a. Execution node 502b includes cache 504b and processor 506b. Execution node 502n includes cache 504n and processor 506n. Each execution node 502a, 502b and 502n is associated with processing one or more data storage and / or data retrieval tasks. For example, a virtual warehouse can handle data storage and data retrieval tasks associated with internal services (such as clustering services, instantiated view refresh services, file compression services, stored procedure services, or file upgrade services). In other embodiments, a specific virtual warehouse can handle data storage and data retrieval tasks associated with a specific data storage system or a specific category of data.

[0110] Similar to the virtual warehouse 1 discussed above, virtual warehouse 2 includes three execution nodes 512a, 512b and 512n. Execution node 512a includes a cache 514a and a processor 516a. Execution node 512b includes a cache 514b and a processor 516b. Execution node 512n includes a cache 514n and a processor 516n. In addition, virtual warehouse 3 includes three execution nodes 522a, 522b and 522n. Execution node 522a includes a cache 524a and a processor 526a. Execution node 522b includes a cache 524b and a processor 526b. Execution node 522n includes a cache 524n and a processor 526n.

[0111] In some embodiments, with respect to data being cached by the execution node, Figure 5The execution nodes shown are stateless. For example, these execution nodes do not store or otherwise maintain state information about the execution nodes or data cached by a particular execution node. Therefore, in the event of an execution node failure, the failed node can be transparently replaced with another node. Since there is no state information associated with the failed execution node, a new (replacement) execution node can easily replace the failed node without having to worry about recreating specific state.

[0112] although Figure 5 The execution nodes shown each include a data cache and a processor, but alternative embodiments may include execution nodes that include any number of processors and any number of caches. In addition, the size of the cache may vary between different execution nodes. Figure 5 The high-speed cache shown in stores data retrieved from one or more data storage devices in the shared database storage 308 in the local execution node. Therefore, the high-speed cache reduces or eliminates the bottleneck problem that occurs in the platform that constantly retrieves data from the remote storage system. Instead of repeatedly accessing data from the remote storage device, the system and method described herein accesses data from the high-speed cache in the execution node, which is significantly faster and avoids the bottleneck problem discussed above. In some embodiments, the high-speed cache is implemented using a high-speed memory device that provides fast access to the cached data. Each cache can store data from any storage device in the shared database storage 308.

[0113] In addition, cache resources and computing resources can vary between different execution nodes. For example, an execution node can include a large amount of computing resources and a minimum of cache resources, so that the execution node can be used for tasks that require a large amount of computing resources. Another execution node can include a large amount of cache resources and a minimum of computing resources, so that the execution node can be used for tasks that require a large amount of data to be cached. Another execution node can include cache resources that provide faster input-output operations, which is useful for tasks that require rapid scanning of large amounts of data. In some embodiments, based on the expected tasks that the execution node will perform, the cache resources and computing resources associated with a specific execution node are determined when the execution node is created.

[0114] In addition, the cache resources and computing resources associated with a particular execution node may change over time based on the changing tasks performed by the execution node. For example, if the tasks performed by the execution node become processor intensive, more processing resources may be allocated to the execution node. Similarly, if the tasks performed by the execution node require a larger cache capacity, more cache resources may be allocated to the execution node.

[0115] Although virtual warehouses 1, 2, and n are associated with the same execution platform 304, multiple computing systems at multiple geographic locations may be used to implement the virtual warehouses. For example, virtual warehouse 1 may be implemented by a computing system at a first geographic location, while virtual warehouses 2 and n may be implemented by another computing system at a second geographic location. In some embodiments, these different computing systems are cloud-based computing systems maintained by one or more different entities.

[0116] In addition, each virtual warehouse Figure 5 1 is shown as having multiple execution nodes. Multiple execution nodes associated with each virtual warehouse can be implemented using multiple computing systems located at multiple geographic locations. For example, an instance of virtual warehouse 1 implements execution nodes 502a and 502b on a computing platform at one geographic location, and implements execution node 502n at a different computing platform at another geographic location. The selection of a particular computing system to implement an execution node can depend on various factors, such as the resource level required for a particular execution node (e.g., processing resource requirements and cache requirements), the resources available at a particular computing system, the communication capabilities of a network within or between geographic locations, and which computing systems have implemented other execution nodes in the virtual warehouse.

[0117] The execution platform 304 is also fault tolerant. For example, if a virtual warehouse fails, the virtual warehouse will be quickly replaced by a different virtual warehouse located in a different geographical location.

[0118] A particular execution platform 304 may include any number of virtual warehouses. In addition, the number of virtual warehouses in a particular execution platform is dynamic, so that new virtual warehouses are created when additional processing and / or cache resources are needed. Similarly, existing virtual warehouses may be deleted when the resources associated with the virtual warehouses are no longer needed.

[0119] In some embodiments, virtual warehouses can perform operations on the same data in the shared database storage 308, but each virtual warehouse has its own execution node with independent processing and cache resources. This configuration allows requests on different virtual warehouses to be processed independently without interfering with each other. This independent processing capability, combined with the ability to dynamically add and remove virtual warehouses, supports adding new processing capabilities for new users without affecting the performance observed by existing users.

[0120] The execution platform 304 can execute queries on external tables that are not managed by the database platform but can be read by the database platform. The execution platform 302 can execute such queries by communicating with the external tables and reading data directly from the external tables.

[0121] Figure 66 is a schematic block diagram of a database platform 102. The database platform 102 includes a data lake notification component 602, an external table notification component 604, an external table metadata component 606, a metadata refresh component 608, a materialized view generation component 610, a materialized view refresh component 612, a query component 614, and a security component 616. The database platform 102 can communicate with a data lake 620, which can include an external table 622. The database platform 102 can further communicate with one or more "internal" tables 626 managed by the database platform 102. The database platform 102 communicates with and can read and write metadata 624, which includes information about one or more data in the data lake 620, the external table 622, and / or the internal table 626.

[0122] The data lake notification component 602 receives notifications that data has been added, deleted, or modified in the data lake 620. The data lake notification component 602 may alternatively be referred to as a data lake notification listener component. The data lake notification component 602 may actively query the data lake 620 to determine whether any data has been added, deleted, or modified since the database platform last read the data in the data lake. The data lake notification component 602 may receive notifications from the data lake 620 that are automatically or manually generated by a data lake provider or client.

[0123] In an embodiment, the data lake notification component 602 is configured to detect updates to a source directory within the data lake 620, where the external table 622 is based on the source directory. In an embodiment, the data lake notification component 602 receives an indication that a file has been added, modified, or removed from the source directory. In an embodiment, the data lake notification component 602 communicates with a simple queue service ("SQS") message. This communication can be established by a client or a system administrator when the external table 622 is generated. The SQS queue id (ARN) can be provided back to the data lake 620 so that a push notification will be generated via SQS whenever a file is added, updated, or deleted from the data lake 620. In an embodiment, the data lake notification component 602 receives SQL commands to register and unregister files in the external table 622. The SQL command can be received from the client and can indicate that the metadata should be refreshed based on the current state of the external table 622 location.

[0124] The external table notification component 604 receives notifications that data has been added, deleted, or modified in the external table 622. The external table notification component 604 may alternatively be referred to as an external table notification listener component. The external table notification component 604 may actively query the external table 622 to determine whether any data has been added, deleted, or modified since the database platform last read the data in the external table 622. The external table notification component 602 may receive notifications from the external table 622 or the data lake 620, which are automatically or manually generated by the data lake provider (i.e., also the external table provider) or the client. The external table 622 may constitute a source table stored in the data lake 620. The source table may be defined by the client, and the client may add, delete, or modify the data stored in the source table. The client may create the external table 622 using the database platform by granting the database platform read permission to the source table in the data lake 620.

[0125] The external table metadata component 606 generates, manages, and refreshes metadata 624, which includes information about the data stored in the external table 622. Fig.10 and Figures 11A-11C The external table metadata component 606 may store metadata 624 according to the metadata structure disclosed in . The external table metadata component 606 may read the data stored in the external table 622 to determine the metadata 624. The external table metadata component 606 may determine the metadata 624 based on how the data is organized within the external table 622. The client may organize the data in the external table 622 according to a hierarchical structure, and may provide the details of the hierarchical structure to the database platform. The hierarchical structure of the organization of the external table 622 includes an indication of the folders and subfolders of how the data in the external table 622 is organized. In an example, the hierarchical structure may indicate that a folder includes all transactions for a particular year, and the subfolders within the folder include all transactions for each month of the year. The data in the external table 622 may be divided into multiple partitions according to some other parameter such as location or name. The client uploads a file to a particular folder in the external table 622, and the location of the file (i.e., to which folder the file is uploaded) guides the external table metadata component 606 to generate metadata 624 about the external table 622.

[0126] The metadata refresh component 608 refreshes metadata 624 about the external table 622 in response to changes made to the external table 622. When data is added, deleted, or updated in the external table 622, the metadata 624 of the external table 622 is refreshed.

[0127] The materialized view generation component 610 generates one or more materialized views according to the external table 622. The materialized view generation component 610 can generate materialized views based on queries received from clients. The client can manually request to generate a materialized view for a certain data set in the external table 622. If the data set is suitable for queries frequently requested by the client, the database platform can automatically determine that a materialized view for a certain data set in the external table 622 should be generated. The materialized view is stored with the database platform 102 and can be stored in a cache storage or in a shared database storage 308. The materialized view can be stored in a cache storage associated with a node of the execution platform 304.

[0128] The materialized view generation component 610 generates a materialized view based on the external table 622. The materialized view generation component 610 can generate a materialized view having its own domain and having tables and views. Figure 2 The materialized view generation component 610 can be configured to generate a materialized view by caching the results of a query through an instantiated process, thereby storing the cached query results as a specific "materialized" table that can be updated from the original external table 622 and / or the source directory within the data lake 620. Materialized views are declarative specifications for persistent query results that are automatically maintained and transparently used. A materialized view is a database object that includes the results of persistent query results on the external table 622 and / or the source directory within the data lake 620. The materialized view can be a local copy of data located remotely, it can be a subset of the rows and / or columns of the source directory or the joined table results, or it can be a summary using an aggregate function. The materialized view generation component 610 can be configured to generate a materialized view by caching the results of a query through an instantiated process, thereby storing the cached query results as a specific "materialized" table that can be updated from the original external table 622 and / or the source directory within the data lake 620. Materialized views can provide improved performance for database queries of large select, join, or aggregate statements. The materialized view provides smaller additional storage than the source catalog, the materialized view can be automatically maintained, and the materialized view can be used transparently without changing the existing workloads on the external table 622 and / or the source catalog within the data lake 620. The materialized view includes additional information linked to its management, including the source catalog identifier, the set of partitions materialized since the last refresh version of the materialized view, and the set of partitions removed since the last compact version of the materialized view.

[0129] In an embodiment, the materialized view generation component 610 stores the same information as the table (e.g., stage information) and the same information as the view (e.g., view definition) in the materialized view. In addition, the materialized view generation component 610 stores a source catalog identifier. The source catalog identifier is marked to the materialized view during compilation to indicate the source catalog that will be used to maintain and incrementally update the materialized view. The materialized view generation component 610 further stores an indication of the type of the materialized view, wherein the type of the materialized view indicates an enumeration type (e.g., projection, summary, synopsis, connection, etc.) used to determine the scope of the materialized view. In addition, the materialized view generation component 610 may include information specific to DML version control, which is added to the table version associated with the materialized view. The materialized view can be marked with the previous refresh time and the previous compression time of the materialized view.

[0130] The materialized view refresh component 612 refreshes the materialized view generated based on the external table. The materialized view refresh component 612 can further refresh the materialized view generated based on the internal table 626 managed by the database platform 102. When data is added, deleted, or updated in the external table, the materialized view refresh component 612 refreshes the materialized view based on the external table. The materialized view can be refreshed after a threshold number of modifications to the external table, after a threshold duration has passed since the last refresh, after each update to the external table, or based on any suitable indicator. In an embodiment, the client can define the time and frequency of refreshing the materialized view, and / or can define parameters for an acceptable amount of inconsistency or obsolescence between the external table and the materialized view.

[0131] The materialized view refresh component 612 can maintain a refresh construct that indicates a set of partitions to be inserted into the materialized view by pulling the log of added partitions that have been added to the source catalog of the data lake 620 since the last refresh of the materialized view. The materialized view refresh component 612 maintains a compact construct that indicates a set of partitions to be removed from the materialized view by pulling the log of partitions that have been removed from the source catalog since the last compaction of the materialized view.

[0132] The materialized view refresh component 612 is configured to perform a refresh on the materialized view by adding one or more partitions or new rows to the materialized view. The materialized view refresh component 612 receives an indication from the data lake notification component 602 and / or the external table notification component 604 that a partition has been inserted into the source catalog of the data lake 620 since the last time the materialized view was refreshed. The materialized view refresh component 612 then inserts the partition into the materialized view. The materialized view refresh component 612 can receive a single source catalog identifier for each materialized view it generates. In an embodiment, the materialized view refresh component 612 is manually triggered, enabled, or disabled by the account that issued the command. In an embodiment, when the materialized view refresh component 612 is enabled, the materialized view refresh component 612 automatically updates the materialized view.

[0133] In an embodiment, the materialized view refresh component 612 executes the insert command. The materialized view refresh component 612 receives a log of new partitions that have been added to the source catalog of the data lake 620 since the previous refresh of the external table and / or materialized view. The materialized view refresh component 612 inserts the new partitions into the materialized view and can be configured to group the new partitions on the columns of the materialized view and sort the new partitions in the materialized view. In an embodiment, the metadata of the new partitions is consistent between the source catalog of the data lake 620 and the external table 622.

[0134] The query component 614 determines a query plan to execute a query on an external table. The resource manager 302 may receive a query from a client. The query may include a structured query language (SQL) query with certain parameters. The query component 614 reads the shared metadata 312 to determine where applicable files to be used to respond to the query are stored. The applicable files may be stored in "internal" data stored in the shared database storage 308 managed by the database platform 102, in a cache storage in the execution platform 304, in an external table 106, in a materialized view, or in any combination of the above. The query component 614 determines the files necessary to respond to the query, and further determines where these files are located in the shared database storage 308, the cache storage in the execution platform 304, the external table 106, and / or the materialized view. The query component 614 generates a query plan, which includes one or more discrete subtasks to be executed in response to the query. The query component 614 assigns one or more discrete subtasks to different nodes of the execution platform 304 for processing. The query component 614 allocates one or more discrete subtasks based on the storage location of the file. For example, if a certain execution node has cached a materialized view containing the data necessary to respond to the query, the execution node will be allocated subtasks related to the data. Further, for example, if a certain execution node has cached an external table or a portion of "internal" data managed by the database platform, the execution node will be allocated subtasks related to the data. The query is executed by the execution platform and can be returned to the client by the resource manager 302.

[0135] The security component 616 manages permissions for the data lake 620, external tables 106, database platform 102, shared database storage 308, and / or materialized views. The security component 616 executes one or more security protocols to protect data in any one of the source directory, external tables 622, metadata 624, internal tables 626, and / or materialized views of the data lake 620. In an embodiment, the security component 616 provides account settings to an account associated with the source directory so that the account can request external tables and / or materialized views generated based on the source directory. In this way, the security component 616 can further provide account settings to a second account associated with the source directory so that the second account does not have permission to request external tables or materialized views. In an embodiment, the security component 616 encrypts data in the source directory, external tables, or materialized views. In an embodiment, the security component 616 resets the key or re-encrypts the data in the source directory, external tables, or materialized views within a predetermined time period upon client request and / or when the data is updated.

[0136] In an embodiment, the work performed by the database platform 102 is performed in the background and can occur in a continuous manner. In an embodiment, once a materialized view is generated based on the external table 622, the database platform 102 is configured to maintain the freshness of the materialized view. In an embodiment, the maximum budget for materialized view maintenance can be changed by the client. The client can provide a large budget for maintenance operations for certain materialized views, but a smaller budget for other materialized views. The client can have access to multiple priority settings for maintenance operations for various materialized views. The client can further receive information indicating the frequency and efficiency of refreshing or compressing materialized views.

[0137] Figure 7 700 is a schematic block diagram of an example process flow 700 for querying an external table. As described herein, the process flow 700 can be performed by a resource manager 302 and an execution platform 304. The client 118 may include an account associated with the resource manager 302 (i.e., associated with the database platform 102) and further associated with the data lake 104 storing the data of the external table 106. The client 118 provides a query to the resource manager 302. The query may include a structured query language (SQL) statement. At 702, the resource manager 302 receives a query from a client account, and the query includes one or more query predicates. At 704, the resource manager 302 references metadata to identify the partitions necessary to respond to the query by determining which partitions in the external table and / or shared database storage 308 include data that satisfies one or more query predicates. At 706, the resource manager 302 generates a query plan, which includes multiple discrete subtasks that need to be processed to respond to the query. At 708, the resource manager 302 assigns the multiple discrete subtasks to one or more nodes of the execution platform.

[0138] The resource manager 302 can allocate multiple discrete subtasks based on metadata and further based on the location of the partitions identified by the storage. For example, the resource manager 302 can reference metadata to understand that the partition of the first identification is stored in the cache storage of the first execution node. Then, the resource manager 302 can allocate the partition of the first identification to the first execution node to speed up the query response time and reduce the processing load to avoid retrieving the partition from an external table or shared database storage 308. Further for example, the resource manager 302 can determine that an identified partition is referenced in a materialized view. The resource manager 302 can allocate an execution node to read the materialized view to execute one of the discrete subtasks of the query plan.

[0139] In the process flow 700, the example execution node 306 of the execution platform 304 has access to the external table 106. At 710, the execution node 306 receives instructions from the resource manager 302 to execute a discrete subtask of a query plan, wherein the discrete subtask requires the execution node 306 to read data in the external table 106. At 712, the execution node 306 accesses the external table to read one or more partitions of the external table specified in the discrete subtask. At 714, the execution node 306 processes the task by reading one or more partitions in the external table and filtering rows that do not satisfy the query predicate to return only those rows that satisfy the query predicate.

[0140] In an embodiment, referencing metadata at 704 to identify partitions necessary to respond to the query includes: referencing shared metadata 312 to identify partitions in the external table, and further identifying partitions in the internal database storage (e.g., data in cache storage and / or shared database storage 308) necessary to respond to the query. Referencing metadata at 704 may further include determining whether a materialized view has been generated based on any data in the external table or the internal table. If the external table and / or the internal table has been modified since the last refresh of the corresponding materialized view, the query plan may include supplementing the materialized view with data from the external table or the internal table. This may be achieved by reading metadata of the materialized view to determine a timestamp when the materialized view was refreshed, and further by reading metadata of the corresponding external table and / or the internal table to determine a timestamp when the external table and / or the internal table was last modified. The timestamps may be compared to determine how many modifications and which modifications have been made to the external table and / or the internal table since the last refresh of the corresponding materialized view. The materialized view may be further supplemented by reading metadata to determine which modifications have been made at certain timestamps. The timestamp may include information about which modifications were made, for example, which data manipulation language (DML) commands were executed, such as update, delete, and / or merge commands. The materialized view may be supplemented based on this metadata to determine which rows in the materialized view are out-of-date with respect to the external and / or internal tables. Those rows determined to be out-of-date will not be read from the materialized view, but rather from the internal and / or external tables.

[0141] Figure 8A schematic block diagram of an example process flow 800 for incremental updates of a materialized view is shown. The process flow 800 can be performed by any suitable computing device, including, for example, the resource manager 302 and / or the database platform 102, and specifically including the materialized view generation component 610 and / or the materialized view refresh component 612. The process flow 800 includes generating a materialized view based on a source table at 802 (e.g., in embodiments disclosed herein, the source table can be an external table based on a data lake source catalog). The process flow 800 includes updating the source table at 804, which can include inserting a partition at 806 and / or removing a partition at 808. The process flow includes querying the materialized view and the source table at 810 to detect any updates to the source table that are not reflected in the materialized view. The process flow 800 includes applying the updates to the materialized view at 812.

[0142] exist Figure 8 In the example shown, a materialized view is generated by scanning a source table at 802. As shown, the source table includes a data set {1 2 3 4 5 6}. The corresponding materialized view includes data sets [1 (1 2 3)] and [2 (4 5 6)], which may indicate partitions in a database, where a partition is an immutable storage object in a database.

[0143] exist Figure 8 In the example shown, at 804, the source table is updated by adding (+7) and deleting (-2) (see Δ1). At 806, two partitions are inserted into the source table by adding (+8) and adding (+9) (see Δ2). At 808, two partitions are removed from the source table by removing (-1) and (-3) (see Δ3). As shown by Δ (variable increment), the overall update to the source table includes {+7+8+9-1-2-3}, which includes each of the individual updates made on the source table (see Δ1, Δ2, and Δ3).

[0144] exist Figure 8 In the example shown, the materialized view and the source table are queried at 810. Query 810 includes merging the materialized view and the source table. The source table is scanned, and partitions {7 8 9} are detected in the source table, but not in the materialized view. The materialized view is scanned, and partitions (1 2 3) to (1 23) are detected in the materialized view, but not in the source table.

[0145] exist Figure 8In the example shown, updates are applied to the materialized view at 812. The materialized view is scanned, and the system detects partitions [1(1 2 3)] and [2(4 5 6)], and the system detects that partition [1(1 2 3)] exists in the materialized view but should be removed. The system drops partition [1(1 2 3)], leaving partition [2(4 5 6)]. The system scans the source table and finds partition {7 8 9} and inserts that partition into the materialized view, so that the materialized view includes partitions [2(4 5 6)] and [3(7 8 9)].

[0146] Fig. 9 A schematic block diagram of an example process flow 900 for updating a materialized view based on an external table is shown. The process flow 900 can be executed by any suitable computing device, which includes, for example, the resource manager 302 and / or the database platform 102, and specifically includes the materialized view generation component 610 and / or the materialized view refresh component 612 of the database platform 102. The materialized view is generated based on the external table, so that the materialized view is generated, refreshed, and stored using the database platform 102, and the source table of the materialized view (i.e., the external table 106) is not managed, stored, or updated by the database platform. The materialized view is internal to the database platform 102, and the source table is external to the database platform 102. The materialized view can be stored in a persistent storage such as the shared database storage 308, or it can be stored in a cache storage such as a cache within the execution node 306 of the execution platform 304. The source table of the materialized view (i.e., the external table) can be stored in a persistent storage in the data lake.

[0147] Process flow 900 includes an initial refresh of a materialized view at 902. The initial refresh at 902 includes scanning an external table (a source table of the materialized view) and refreshing the materialized view. Process flow 900 includes an update to the external table at 904. The update may be initiated by a client communicating with a data lake supporting the external table, and the update may be implemented by a provider of the data lake. Fig. 9 In the example of , micro-partition 5 (MP5) and micro-partition 6 (MP6) are updated. The update may include modifying entries in one or more rows of MP5 and MP6.

[0148] Process flow 900 includes an insert into an external table at 906. The insert may be initiated by a client communicating with a data lake supporting external tables, and the insert may be implemented by a provider of the data lake. Fig. 9In the example of , the insertion performed at 906 is performed on micro-partition 1 (MP1) and micro-partition 2 (MP2). The insertion may include adding one or more rows to MP1 or MP2. If one or more partitions did not exist before, the insertion may include adding MP1 or MP2.

[0149] Process flow 900 includes a delete performed on the external table at 908. The delete may be initiated by a client communicating with a data lake supporting the external table, and the delete may be implemented by a provider of the data lake. Fig. 9 In the example of , the deletion performed at 908 is performed on micro-partition 3 (MP3) and micro-partition 4 (MP4). The deletion may include removing one or more lines from MP3 and / or MP4. The deletion may include MP3 and / or MP4 being completely removed.

[0150] Processing flow 900 includes applying changes made to an external table (i.e., a source table of the materialized view) to the materialized view at 910. Applying the changes at 910 includes generating a new MP5 and a new MP6 with updated rows based on the update made to the external table at 904. Applying the updates includes removing and replacing the modified rows. Applying the changes at 910 includes generating a new MP1 and a new MP2 with inserted rows based on the insert made to the external table at 906. Applying the changes at 910 includes generating a new MP3 and a new MP4, wherein deleted rows are removed based on the delete made to the external table at 908. Processing flow 900 includes querying the materialized view at 912. Because the materialized view has been refreshed to reflect the updates made to the external table, queries can be executed on the materialized view rather than on the external table itself to speed up query response time.

[0151] Fig.10 is a schematic diagram of a data structure 1000 for storage of database metadata (including in persistent storage and cache storage). The data structure 1000 can be applied to the storage of metadata of external tables that are not managed by the database platform 102 and / or internal tables that are managed and stored by the database platform 102. The data structure 1000 includes cumulative table metadata 1002, which includes information about the table. The table can be an external table or an internal table. The table may include multiple files or partitions, each of which may include many columns and rows of stored data. The cumulative table metadata 1002 includes global information about the table and may include summary information stored in each of multiple group expression attributes 1014a, 1014b, 1014c and 1014d (which may be collectively referred to as "1014" herein). The group expression attributes 1014 include aggregated partition statistics about a partition 1006 or a collection of partitions of a table, cumulative column attributes, and the like. It should be understood that Fig.10The partitions 1006 shown may each contain a different subset of the data stored in the table and may include the same columns or may include different columns storing different types of information. The partitions 1006 of the table may each include one or more columns and may each have the same type of columns or different types of columns. Fig.10 Each column of each partition 1006 of the table or a collection of partitions 1006 of the table is shown to store an expression attribute. The data structure 1000 includes partition statistics 1004 for each partition 1006 of the table (the partition statistics 1004 may alternatively be referred to herein as "partition expression attributes"). The partition statistics 1004 may include the minimum / maximum data points of the corresponding partition 1006, the type of data stored in the corresponding partition 1006, the partition structure of the corresponding partition 1006, etc. Fig.10 As shown, column 1 expression attribute 1008 is stored for the first column in each partition in different partitions 1006. In addition, column 2 expression attribute 1010 is stored for the second column in each partition in different partitions 1006. In addition, column 3 expression attribute 1012 is stored for the third column in each partition in different partitions. It should be understood that each partition 1006 can include any suitable number of columns, and expression attributes can be stored for each column, or for any suitable number of columns, and expression attributes are stored in each partition of the table. Column 1 expression attribute 1008, column 2 expression attribute 1010, and column 3 expression attribute 1012, as well as any other column expression attributes that may be included as appropriate, can be stored as part of the metadata partition. The metadata partition can be persistently stored in an immutable storage, and the grouping expression attribute 1014 can also be stored in the metadata partition in the immutable storage. The metadata manager can maintain all metadata partitions, including metadata partitions containing grouping expression attributes 1014 and partition statistics 1004 and / or column expression attributes 1008-1012.

[0152] Cumulative table metadata 1002 includes global information about all partitions within an available table. For example, cumulative table metadata 1002 may include global minimum and global maximum values ​​for the entire table, which may include millions or even hundreds of millions of partitions. Cumulative table metadata 1002 may include any suitable information about the data stored in the table, including, for example, minimum / maximum values, null value counts, summaries of database data stored together in the table, data types stored in the table, distinctness of data stored in the table, and the like.

[0153] The grouping expression attributes 1014a-1014d include information about the database data stored in the associated groupings of the partitions. For example, the example grouping expression attribute is associated with the partitions numbered 3040 to 3090, so that the example grouping expression attribute is associated with fifty different partitions. The example grouping expression attribute includes information about these fifty different partitions. The grouping expression attribute 1014 may include any suitable information about the partition associated with it. For example, the grouping expression attribute 1014 may include a global minimum / maximum value for a common set of partitions, a minimum / maximum value for each partition within the grouping, a global null value count, a null value count for each partition within the grouping, a global summary of the data stored in common in the grouping of the entire partition, a summary of the data stored in each partition in the grouping, and the like. The grouping expression attribute 1014 may include global information for all partitions within the grouping of the partition associated with the grouping expression attribute 1014, and it may further include information specific to each partition within the associated grouping.

[0154] Compared with other embodiments of the database metadata structure, Fig.10 The metadata structure disclosed in provides increased granularity in accumulating table metadata 1002. The grouped expression attributes 1014 provide valuable global metadata about a collection of partitions 1006 of a database. In addition, each column expression attribute 1008, 1010, 1012 provides valuable information about the columns of the partition 1006 of the table.

[0155] When responding to a database query, the metadata structure disclosed herein (including Fig.10The data structure 1000 shown in the figure improves efficiency. Database queries can request any data set from a database and / or an external table, and can be used to create advanced analysis and metrics about database data and / or data stored in an external table. Some queries (especially queries for large databases, external tables and / or data lakes) may be extremely expensive to run in terms of time and computing resources. When it is necessary to scan the metadata and / or database data of each file or partition of each table of the database, it may take minutes or even hours to respond to the query. In some embodiments, this may not be an acceptable use of computing resources. The data structure 1000 disclosed herein provides increased metadata granularity and enables multi-level pruning of database data and / or data stored in external tables. During the compilation and optimization of queries on the database, the processor can scan the cumulative table metadata 1002 to determine whether the table includes information related to the query. In response to determining that the table includes information related to the query based on the cumulative table metadata 1002, the processor can scan each grouping expression attribute 1014 to determine which groups of the partitions of the table include information related to the query. In response to determining that a first grouping of partitions does not include information relevant to the query based on the first cumulative expression attribute, the processor can suspend database scanning of the first grouping of partitions. In response to determining that a second grouping of partitions includes information relevant to the query based on the second cumulative expression attribute, the processor can continue to scan the expression attributes of the second grouping of partitions. The processor can effectively determine which partitions include relevant data, and which columns of which partitions include relevant data. The processor can continue to scan only relevant columns and partitions that include information relevant to the database query. This provides a cost-effective apparatus for responding to database queries through multi-level pruning based on multi-level table metadata.

[0156] To further improve the cost efficiency of database queries, the resource manager (which may also be referred to as a "global service") may store the cumulative table metadata 1002 in a cache for faster retrieval. The metadata for a database may be stored in a metadata store that is independent and separate from multiple shared storage devices that collectively store the database data. In various embodiments, the metadata for a database may be stored within multiple shared storage devices that collectively store the database data. In various embodiments, the metadata may be stored in a metadata-specific partition that does not include the database data, and / or may be stored within a partition that also includes the database data. The metadata may be stored across disk storage (such as multiple shared storage devices), and it may also be stored in a cache within the resource manager.

[0157] Figures 11A-11CThe generation of cumulative table metadata 1102 across multiple versions of a table is shown. The table may be stored inside the database platform, or may be an external table. Figures 11A-11C The metadata versioning shown may be performed by any suitable computing device including the database platform 102, and in particular including an external table metadata component 606 and / or a metadata refresh component 608. The refreshing and versioning of the table metadata may be prompted by receiving a notification from the data lake that a source table backing the external table has been modified. Figures 11A-11C The metadata structure depicted in follows Fig.10 . Thus, there is cumulative table metadata 1102, which includes global information about the table and grouping expression attributes 1104 for each grouping of table partitions. In addition, the table includes multiple partitions, each partition serving as an immutable storage device for storing database data that cannot be updated in place.

[0158] Fig.11A The metadata of the first version (V1) of the table is shown. The table has version one cumulative table metadata 1102a and version one grouping expression attributes 1104a, each of which includes global information about the grouping of partitions 1106 of the table. Fig.11A Version 1 including partitions A1, B1, C1, D1, E1, F1, G1, and H1 is shown in . The table includes multiple partitions, each partition storing a subset of the database data in the table.

[0159] Fig. 11B : Metadata for a second version of the table (V2) is shown, which includes a second version of the partitions, including A2, B2, C2, D2, E2, F2, G2, H2, I2, J2, K2, and L2. The crossed-out partitions (C2, E2, and G2) show partitions that were deleted by transactions executed on the table. The new partitions (I2, J2, K2, and L2) show partitions added to the table by transactions executed on the table. The existing partitions (A2, B2, D2, F2, and H2) that are not crossed out show partitions that have not been modified by any transactions executed on the table. Fig. 11BAs shown, in response to a new version of the table generated by one or more transactions executed on the table, version two cumulative table metadata 1102b is generated. In addition, in response to the new version of the table generated by one or more transactions executed on the table, a new version two grouping expression attribute 1104b is generated. In an embodiment, when a partition is deleted from a grouping of partitions, but no new partitions are added to the grouping, the grouping expression attribute 1104b may not need to be recalculated. The minimum value, maximum value, number of null values, and number of distinct values ​​may now be overestimated, but the database client may still consider this to be safe. The overestimated values ​​may cause the optimizer to make suboptimal decisions, but will not lead to incorrect query results. In this embodiment, the grouping expression attribute 1104b may still be recalculated for optimizer efficiency considerations. Fig. 11B In the example shown, after partitions C2, E2 and G2 are deleted, the existing grouping expression attributes 1104b for the first and second groups can still be safely used. These grouping expression attributes 1104b may not be recalculated or may be recalculated at a later stage. For each new version of the table, the grouping expression attributes can be calculated for the grouping of the newly added partitions, which can result in the effective calculation of the global grouping expression attributes. Each partition 1106 of the table constitutes an immutable storage device that cannot be updated in place. Therefore, in response to a transaction executed on the table such as a DML command, a new partition is generated to reflect the transaction and replace the previous partition.

[0160] Fig. 11C The metadata of the third version (V3) of the table is shown. As shown, new partitions have been added to the table of version three, including partitions M3, N3, O3, and P3. The updated version three cumulative table metadata 1102c provides global information about the table, and the updated version three grouping expression attributes 1104c each provide global information about the associated groupings of the version three partitions.

[0161] Fig.12 1 is a schematic flow chart of a method 1200 for maintaining an external table in a database system. The method 1200 may be performed by any suitable computing device, such as the resource manager 302 or the database platform 102 disclosed herein.

[0162] Method 1200 begins, and at 1202, a computing device receives read access to a source directory in a data storage platform. The computing device is associated with a database platform separate from the data storage platform. At 1204, the computing device defines an external table based on the source directory. At 1206, the computing device connects the database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. At 1208, the computing device generates metadata for the external table, the metadata including information about the data stored in the external table. At 1210, the computing device receives a notification that a modification has been made to the source directory, the modification including one or more of an insert, a delete, or an update. At 1212, in response to the modification made to the source directory, the computing device refreshes the metadata for the external table.

[0163] Fig.13 1 is a schematic flow chart of a method 1300 for defining an external table in a database system. The method 1300 may be performed by any suitable computing device, such as the resource manager 302 or the database platform 102 disclosed herein.

[0164] The method 1300 begins, and a computing device receives an indication of a hierarchical structure in a source directory, the hierarchical structure defining folders and subfolders for data in the source directory, at 1302. At 1304, the computing device receives an indication of a partition structure for the data in the source directory. At 1306, the computing device defines partitions in an external table based on locations where files are uploaded within the hierarchical structure and further based on the partition structure.

[0165] Fig.14 14 is a schematic flow chart of a method 1400 for querying an external table in a database system. The method 1400 may be performed by any suitable computing device, such as the resource manager 302 or the database platform 102 disclosed herein.

[0166] Method 1400 begins, and at 1402, a computing device connects a database platform to an external table so that the database platform has read access to the external table but does not have write access to the external table. At 1404, a computing device receives a query including a predicate, the query being directed at least to data in the external table. At 1406, the computing device determines one or more partitions in the external table that include data that satisfies the predicate based on metadata. At 1408, the computing device prunes all partitions in the external table that do not include any data that satisfies the predicate based on the metadata. At 1410, the computing device generates a query plan that includes a plurality of discrete subtasks. At 1412, the computing device assigns the plurality of discrete subtasks to one or more nodes in an execution platform based on the metadata.

[0167] Fig.151 is a schematic flow chart of a method 1500 for generating a materialized view from an external table in a database system. The method 1500 may be executed by any suitable computing device, such as the resource manager 302 or the database platform 102 disclosed herein.

[0168] Method 1500 begins, and at 1502, a computing device connects a database platform to an external table so that the database platform has read access to the external table but does not have write access to the external table. At 1504, the computing device generates a materialized view based on the external table. At 1506, the computing device receives a notification that a modification has been made to the external table, the modification including one or more of an insert, a delete, or an update. At 1508, in response to the external table being modified, the computing device refreshes the materialized view so that the materialized view includes an accurate representation of the external table.

[0169] Fig.16 1 is a schematic flow chart of a method 1600 for querying an external table in a database system. The method 1600 may be performed by any suitable computing device, such as the resource manager 302 or the database platform 102 disclosed herein.

[0170] Method 1600 begins, and at 1602, a computing device connects a database platform to an external table so that the database platform has read access to the external table but no write access to the external table. At 1604, a computing device receives a query including a predicate, the query being directed at least to data in the external table. At 1606, the computing device determines one or more partitions in the external table that include data satisfying the predicate based on metadata. At 1608, the computing device prunes all partitions in the external table that do not include any data satisfying the predicate based on the metadata. At 1610, the computing device generates a query plan including a plurality of discrete subtasks. At 1612, the computing device reads the metadata to determine whether a first partition is stored in a cache of any particular node of an execution platform. At 1614, in response to the first partition being stored in a cache of a particular node of the execution platform, the computing device assigns the first partition to a particular node for processing by the particular node.

[0171] Fig.171 is a block diagram depicting an example computing device 1700. In some embodiments, computing device 1700 is used to implement one or more systems and components discussed herein. In addition, computing device 1700 can interact with any of the systems and components described herein. Therefore, computing device 1700 can be used to perform various processes and tasks, such as those discussed herein. Computing device 1700 can be used as a server, client, or any other computing entity. Computing device 1700 can be any of a variety of computing devices, such as a desktop computer, a notebook computer, a server computer, a handheld computer, a tablet computer, etc.

[0172] The computing device 1700 includes one or more processors 1702, one or more memory devices 1704, one or more interfaces 1706, one or more mass storage devices 1708, and one or more input / output (I / O) devices 1710, all coupled to a bus 1712. The one or more processors 1702 include one or more processors or controllers that execute instructions stored in the one or more memory devices 1704 and / or the one or more mass storage devices 1708. The one or more processors 1702 may also include various types of computer-readable media, such as cache memory.

[0173] One or more memory devices 1704 include various computer-readable media, such as volatile memory (e.g., random access memory (RAM)) and / or nonvolatile memory (e.g., read-only memory (ROM)). One or more memory devices 1704 may also include a rewritable ROM, such as a flash memory.

[0174] The one or more mass storage devices 1708 include various computer-readable media, such as tapes, disks, optical disks, solid-state memory (e.g., flash memory), etc. Various drives may also be included in the one or more mass storage devices 1708 to enable reading and / or writing of various computer-readable media. The one or more mass storage devices 1708 include removable media and / or non-removable media.

[0175] The one or more I / O devices 1710 include various devices that allow data and / or other information to be input to or retrieved from the computing device 1700. Example I / O devices 1710 include a cursor control device, a keyboard, a keypad, a microphone, a monitor or other display device, a speaker, a printer, a network interface card, a modem, a lens, a CCD or other image capture device, and the like.

[0176] Interface(s) 1706 include various interfaces that allow computing device 1700 to interact with other systems, devices, or computing environments. Example interfaces 1706 include any number of different network interfaces, such as interfaces to a local area network (LAN), a wide area network (WAN), a wireless network, and the Internet.

[0177] The bus 1712 allows the one or more processors 1702, the one or more memory devices 1704, the one or more interfaces 1706, the one or more mass storage devices 1708, and the one or more I / O devices 1710 to communicate with each other and with other devices or components coupled to the bus 1712. The bus 1712 represents one or more of several types of bus structures, such as a system bus, a PCI bus, an IEEE 1394 bus, a USB bus, and the like.

[0178] For the purpose of illustration, programs and other executable program components are shown herein as discrete blocks, although it should be understood that such programs and components may reside in different storage components of the computing device 1700 at different times and be executed by one or more processors 1702. Alternatively, the systems and processes described herein may be implemented in hardware or a combination of hardware, software, and / or firmware. For example, one or more application specific integrated circuits (ASICs) may be programmed to perform one or more of the systems or processes described herein. As used herein, the term "module" or "component" is intended to convey an implementation device for performing a process such as by hardware or a combination of hardware, software, and / or firmware, so as to perform all or part of the operations disclosed herein. The term "module" or "component" is intended to be independently communicated in terms of how a module, component, or its functionality or hardware aspects may be implemented in different embodiments.

[0179] Example

[0180] The following examples relate to other embodiments.

[0181] Example 1 is a system for generating a materialized view from an external table. The system includes means for connecting a database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The system includes means for generating a materialized view from the external table. The system includes means for receiving a notification that a modification has been made to the external table, the modification including one or more of an insert, a delete, or an update. The system includes means for refreshing the materialized view in response to the external table being modified so that the materialized view includes an accurate representation of the external table.

[0182] Example 2 is a system according to Example 1, wherein the external table is based on a source directory in a data storage platform, wherein the data storage platform is separate from the database platform.

[0183] Example 3 is a system according to any one of Examples 1-2, further comprising a device for determining content of a materialized view, wherein the device for determining content comprises one or more of the following: a device for receiving an indication to generate a materialized view having content; a device for receiving a query to an external table, the query being for the content; or a device for determining content based on one or more rows or partitions of a frequently queried external table.

[0184] Example 4 is a system according to any one of Examples 1-3, wherein the means for receiving notifications includes one or more of: means for querying the data storage platform to determine whether any modifications have been made to the source directory; means for receiving a notification from the data storage platform that the source directory has been modified; or means for receiving a notification from a client associated with the source directory indicating that the source directory has been modified.

[0185] Example 5 is a system according to any one of Examples 1-4, wherein the means for refreshing the materialized view includes means for generating a new materialized view and means for removing the original materialized view that is now outdated with respect to the external table.

[0186] Example 6 is a system according to any one of Examples 1-5, further comprising: a device for receiving a query; a device for determining one or more partitions in the external table required to respond to the query by reading metadata of the external table; and a device for determining whether a corresponding materialized view has been generated for at least one of the one or more partitions.

[0187] Example 7 is a system according to any one of Examples 1-6, further comprising: a device for generating a query plan for responding to a query, the query plan comprising multiple discrete subtasks; and a device for assigning the multiple discrete subtasks to one or more nodes of an execution platform; wherein, in response to the existence of a corresponding materialized view for at least one of the one or more partitions, at least one of the multiple discrete subtasks comprises reading the corresponding materialized view; and wherein, in response to the absence of a corresponding materialized view for at least one of the one or more partitions, at least one of the multiple discrete subtasks comprises reading an external table.

[0188] Example 8 is a system according to any one of Examples 1-7, further comprising means for determining whether a corresponding materialized view is out-of-date with respect to at least one of the one or more partitions.

[0189] Example 9 is a system according to any one of Examples 1-8, further comprising a device for generating metadata for a materialized view, the metadata comprising one or more of the following: an identification of one or more partitions of an external table that are instantiated in the materialized view; a minimum / maximum value pair for each partition of the one or more partitions instantiated in the materialized view; or a timestamp for the most recent refresh of the materialized view.

[0190] Example 10 is a system according to any one of Examples 1-9, further comprising: a device for reading a timestamp of a last modification to an external table for each of one or more partitions instantiated in a materialized view; a device for reading a timestamp of a last refresh of a materialized view; and a device for determining whether the materialized view is out-of-date with respect to the external table based on the timestamp of the last refresh of the materialized view and each timestamp of a last modification to the external table for each of one or more partitions instantiated in the materialized view.

[0191] Example 11 is a method for generating a materialized view from an external table. The method includes connecting a database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The method includes generating, by the database platform, a materialized view from the external table. The method includes receiving a notification that a modification has been made to the external table, the modification including one or more of an insert, a delete, or an update. The method includes, in response to the external table being modified, refreshing the materialized view so that the materialized view includes an accurate representation of the external table.

[0192] Example 12 is a method according to Example 11, wherein the external table is based on a source directory in a data storage platform, wherein the data storage platform is separate from the database platform.

[0193] Example 13 is a method according to any one of Examples 11-12, further comprising determining the content of the materialized view by one or more of the following: receiving an indication to generate a materialized view having content; receiving a query to an external table, the query being for the content; or determining the content based on one or more rows or partitions of a frequently queried external table.

[0194] Example 14 is a method according to any one of Examples 11-13, wherein receiving the notification includes one or more of the following: querying the data storage platform to determine whether any modifications have been made to the source directory; receiving a notification from the data storage platform that the source directory has been modified; or receiving a notification from a client associated with the source directory indicating that the source directory has been modified.

[0195] Example 15 is a method according to any one of Examples 11-14, wherein refreshing the materialized view includes generating a new materialized view and removing the original materialized view that is now outdated with respect to the external table.

[0196] Example 16 is a method according to any one of Examples 11-15, further comprising: receiving a query; determining one or more partitions in the external table required to respond to the query by reading metadata of the external table; and determining whether a corresponding materialized view has been generated for at least one of the one or more partitions.

[0197] Example 17 is a method according to any one of Examples 11-16, further comprising: generating a query plan for responding to a query, the query plan comprising multiple discrete subtasks; and assigning the multiple discrete subtasks to one or more nodes of an execution platform; wherein, in response to the existence of a corresponding materialized view for at least one of the one or more partitions, at least one of the multiple discrete subtasks comprises reading the corresponding materialized view; and wherein, in response to the absence of a corresponding materialized view for at least one of the one or more partitions, at least one of the multiple discrete subtasks comprises reading an external table.

[0198] Example 18 is a method according to any one of Examples 11-17, further comprising determining whether a corresponding materialized view is out-of-date with respect to at least one of the one or more partitions.

[0199] Example 19 is a method according to any one of Examples 11-18, further comprising generating metadata for a materialized view, the metadata comprising one or more of the following: an identifier of one or more partitions of an external table instantiated in the materialized view; a minimum / maximum value pair for each partition of the one or more partitions instantiated in the materialized view; or a timestamp of the last refresh of the materialized view.

[0200] Example 20 is a method according to any one of Examples 11-19, further comprising: reading the timestamp of the most recent modification to the external table for each of one or more partitions instantiated in the materialized view; reading the timestamp of the most recent refresh of the materialized view; and determining whether the materialized view is out-of-date with respect to the external table based on the timestamp of the most recent refresh of the materialized view and each timestamp of the most recent modification to the external table for each of one or more partitions instantiated in the materialized view.

[0201] Example 21 is a processor programmable to execute instructions stored in a non-transitory computer-readable storage medium. The instructions include connecting a database platform to an external table so that the database platform has read access to the external table but no write access to the external table. The instructions include generating, by the database platform, a materialized view based on the external table. The instructions include receiving a notification that a modification has been made to the external table, the modification including one or more of an insert, a delete, or an update. The instructions include refreshing the materialized view in response to the external table being modified so that the materialized view includes an accurate representation of the external table. The instructions cause the external table to be based on a source directory in a data storage platform, wherein the data storage platform is separate from the database platform.

[0202] Example 22 is a processor according to Example 21, wherein the instruction also includes determining the content of the materialized view by one or more of the following: receiving an instruction to generate a materialized view with content; receiving a query to an external table, the query being for the content; or determining the content based on one or more rows or partitions of a frequently queried external table.

[0203] Example 23 is a processor according to any one of Examples 21-22, wherein receiving the notification includes one or more of the following: querying the data storage platform to determine whether any modifications have been made to the source directory; receiving a notification from the data storage platform that the source directory has been modified; or receiving a notification from a client associated with the source directory indicating that the source directory has been modified.

[0204] Example 24 is a processor according to any one of Examples 21-23, wherein refreshing the materialized view includes generating a new materialized view and removing the original materialized view that is now out of date with respect to the external table.

[0205] Example 25 is a processor according to any one of Examples 21-24, wherein the instruction also includes: receiving a query; determining one or more partitions in the external table required to respond to the query by reading metadata of the external table; determining whether a corresponding materialized view has been generated for at least one of the one or more partitions; generating a query plan for responding to the query, the query plan including multiple discrete subtasks; and assigning the multiple discrete subtasks to one or more nodes of the execution platform; wherein, in response to the existence of a corresponding materialized view for at least one of the one or more partitions, at least one of the multiple discrete subtasks includes reading the corresponding materialized view; and wherein, in response to the absence of a corresponding materialized view for at least one of the one or more partitions, at least one of the multiple discrete subtasks includes reading the external table.

[0206] Example 26 is a system for querying an external table. The system includes a device for connecting a database platform to the external table so that the database platform has read access to the external table but no write access to the external table. The system includes a device for receiving a query including a predicate, the query being at least directed to data in the external table. The system includes a device for determining one or more partitions in the external table including data that satisfies the predicate based on metadata. The system includes a device for pruning all partitions in the external table that do not include any data that satisfies the predicate based on metadata. The system includes a device for generating a query plan including a plurality of discrete subtasks. The system includes a device for assigning the plurality of discrete subtasks to one or more nodes in the execution platform based on metadata.

[0207] Example 27 is a system according to Example 26, wherein the external table is based on a source directory in a data storage platform, wherein the data storage platform is separate from the database platform.

[0208] Example 28 is a system according to any one of Examples 26-27, further comprising: a device for determining, based on metadata, one or more partitions in the internal database data that include data that satisfies a predicate; and a device for pruning, based on metadata, all partitions in the internal database data that do not include any data that satisfies the predicate; wherein the database platform has read access to the internal database data and further has write access to the internal database data.

[0209] Example 29 is a system according to any one of Examples 26-28, wherein, in response to the presence of one or more partitions from each of the external table and the internal database data that include data that satisfies the predicate, the multiple discrete subtasks of the query plan include tasks for processing the partitions in the external table and further for processing the partitions in the internal database data.

[0210] Example 30 is a system according to any one of Examples 26-29, wherein the device for allocating multiple discrete subtasks based on metadata also includes: a device for reading metadata to determine whether the first partition is stored in the cache of any specific node of the execution platform; and in response to the first partition being stored in the cache of the specific node of the execution platform, a device for allocating the first partition to a specific node.

[0211] Example 31 is a system according to any one of Examples 26-30, further comprising a device for generating metadata, wherein the metadata includes information about data stored in an external table, the information including one or more of the following: cumulative table metadata for the external table; grouping expression attributes for grouping partitions in the external table; expression attributes for partitions of the external table; partition statistics for partitions of the external table; or column expression attributes for columns of partitions of the external table.

[0212] Example 32 is a system according to any of Examples 26-31, further comprising means for receiving a notification that a modification has been made to the external table, the modification comprising one or more of an insert, a delete, or an update.

[0213] Example 33 is a system according to any one of Examples 26-32, further comprising means for refreshing metadata in response to a modification to the external table.

[0214] Example 34 is a system according to any of Examples 26-33, further comprising means for refreshing metadata in response to a threshold number of modifications to the external table.

[0215] Example 35 is a system according to any one of Examples 26-34, further comprising a device for storing metadata in a partitioned storage object on a shared storage platform associated with the database platform, wherein the shared storage platform is separate from the external table.

[0216] Example 36 is a method for querying an external table. The method includes connecting a database platform to the external table so that the database platform has read access to the external table but no write access to the external table. The method includes receiving a query including a predicate, the query being at least directed to data in the external table. The method includes determining, based on metadata, one or more partitions in the external table that include data that satisfies the predicate. The method includes pruning all partitions in the external table that do not include any data that satisfies the predicate based on the metadata. The method includes generating a query plan including a plurality of discrete subtasks. The method includes assigning the plurality of discrete subtasks to one or more nodes in the execution platform based on the metadata.

[0217] Example 37 is a method according to Example 36, wherein the external table is based on a source directory in a data storage platform, wherein the data storage platform is separate from the database platform.

[0218] Example 38 is a method according to any one of Examples 36-37, further comprising: determining one or more partitions of the internal database data that contain data satisfying a predicate based on metadata; and pruning all partitions of the internal database data that do not include any data satisfying the predicate based on the metadata; wherein the database platform has read access to the internal database data and further has write access to the internal database data.

[0219] Example 39 is a method according to any one of Examples 36-38, wherein, in response to the presence of one or more partitions from each of the external table and the internal database data that include data that satisfies the predicate, the plurality of discrete subtasks of the query plan include tasks for processing the partitions in the external table and further for processing the partitions in the internal database data.

[0220] Example 40 is a method according to any one of Examples 36-39, wherein allocating multiple discrete subtasks based on metadata further includes: reading the metadata to determine whether the first partition is stored in the cache of any specific node of the execution platform; and in response to the first partition being stored in the cache of the specific node of the execution platform, allocating the first partition to the specific node.

[0221] Example 41 is a method according to any one of Examples 36-40, further comprising: generating metadata, wherein the metadata includes information about data stored in the external table, the information including one or more of the following: cumulative table metadata of the external table; grouping expression attributes of the groupings of the partitions in the external table; expression attributes of the partitions of the external table; partition statistics of the partitions of the external table; or column expression attributes of the columns of the partitions of the external table.

[0222] Example 42 is a method according to any of Examples 36-41, further comprising receiving a notification that a modification has been made to the external table, the modification comprising one or more of an insert, a delete, or an update.

[0223] Example 43 is a method according to any of Examples 36-42, further comprising refreshing the metadata in response to a modification to the external table.

[0224] Example 44 is a method according to any of Examples 36-43, further comprising refreshing the metadata in response to a threshold number of modifications to the external table.

[0225] Example 45 is a method according to any one of Examples 36-44, further comprising storing the metadata in a partitioned storage object on a shared storage platform associated with the database platform, wherein the shared storage platform is separate from the external table.

[0226] Example 47 is a processor programmable to execute instructions stored in a non-transitory computer-readable storage medium, the instructions comprising: connecting a database platform to an external table so that the database platform has read access to the external table but not write access to the external table; receiving a query including a predicate, the query being at least directed to data in the external table; based on metadata, determining one or more partitions in the external table that include data that satisfies the predicate; based on the metadata, pruning all partitions in the external table that do not include any data that satisfies the predicate; generating a query plan including multiple discrete subtasks; based on the metadata, assigning the multiple discrete subtasks to one or more nodes in the execution platform; wherein the external table is based on a source directory in a data storage platform, wherein the data storage platform is separate from the database platform.

[0227] Example 48 is a processor according to Example 47, the instructions also including: based on metadata, determining one or more partitions in the internal database data that include data that satisfies the predicate; and pruning all partitions in the internal database data that do not include any data that satisfies the predicate based on the metadata; wherein the database platform has read access to the internal database data and further has write access to the internal database data; and wherein, in response to the presence of one or more partitions from each of the external table and the internal database data that include data that satisfies the predicate, the plurality of discrete subtasks of the query plan include tasks for processing data partitions in the external table and further for processing partitions in the internal database data.

[0228] Example 49 is a processor according to any one of Examples 47-48, wherein allocating multiple discrete subtasks based on metadata also includes: reading the metadata to determine whether the first partition is stored in the cache of any specific node of the execution platform; and in response to the first partition being stored in the cache of the specific node of the execution platform, allocating the first partition to the specific node.

[0229] Example 50 is a processor according to any one of Examples 47-49, wherein the instructions further include: generating metadata, wherein the metadata includes information about data stored in the external table, the information including one or more of the following: cumulative table metadata for the external table; grouping expression attributes of groupings of partitions in the external table; expression attributes of partitions of the external table; partition statistics of partitions of the external table; or column expression attributes of columns of partitions of the external table.

[0230] Example 51 is a processor according to any one of Examples 47-50, wherein the instructions further include: receiving a notification that a modification has been made to the external table, the modification comprising one or more of an insert, a delete, or an update; and refreshing the metadata in response to the modification made to the external table.

[0231] Example 52 is a system. The system includes means for receiving, by a database platform, read access to a source directory in a data storage platform separate from the database platform. The system includes means for defining an external table based on the source directory. The system includes means for connecting the database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The system includes means for generating metadata for the external table, the metadata including information about the data stored in the external table. The system includes means for receiving a notification that a modification has been made to the source directory, the modification including one or more of an insert, a delete, or an update. The system includes means for refreshing metadata for the external table in response to the modification to the source directory.

[0232] Example 53 is a system according to Example 52, wherein the device for generating metadata includes one or more of the following: a device for defining cumulative table metadata for an external table; a device for defining grouping expression attributes for groupings of partitions in the external table; a device for defining expression attributes for partitions of the external table; a device for defining partition statistics for partitions of the external table; or a device for defining column expression attributes for columns of partitions of the external table.

[0233] Example 54 is a system according to any one of Examples 52-53, further comprising a device for storing metadata in a partitioned storage object on a shared storage platform associated with the database platform, wherein the shared storage platform is separate from the data storage platform.

[0234] Example 55 is a system according to any one of Examples 52-54, wherein the device for refreshing metadata includes one or more of the following: a device for refreshing metadata in response to any modification to the source directory; a device for refreshing metadata within a threshold time period; a device for refreshing metadata in response to a threshold number of modifications to the source directory; or a device for refreshing metadata in response to a client request to refresh the metadata.

[0235] Example 56 is a system according to any of Examples 52-55, further comprising means for reading a plurality of different file formats in a source directory.

[0236] Example 57 is a system according to any one of Examples 52-56, wherein the means for receiving notifications includes one or more of: means for querying the data storage platform to determine whether any modifications have been made to the source directory; means for receiving a notification from the data storage platform that modifications have been made to the source directory; or means for receiving a notification from a client associated with the source directory indicating that modifications have been made to the source directory.

[0237] Example 58 is a system according to any one of Examples 52-57, wherein the device for defining an external table based on a source directory includes: a device for receiving an indication of a hierarchical structure in the source directory, the hierarchical structure defining folders and subfolders for data in the source directory; a device for receiving an indication of a partition structure for the data in the source directory; and a device for defining partitions in the external table based on the location where the file is uploaded within the hierarchical structure and further based on the partition structure.

[0238] Example 59 is a system according to any one of Examples 52-58, wherein the device for defining partitions in the external table includes a device for generating metadata for the partitions in the external table, and a device for pointing the metadata to appropriate folders and subfolders in the source directory.

[0239] Example 60 is a system according to any of Examples 52-59, wherein the means for receiving a notification comprises means for receiving a notification that a subfolder within the source directory has been modified.

[0240] Example 61 is a system according to any one of Examples 52-60, further including: a device for identifying in an external table a specific partition corresponding to a specific subfolder within a source directory; and a device for generating change tracking metadata for the specific partition indicating how the specific subfolder was modified and when the specific subfolder was modified.

[0241] Example 62 is a method. The method includes receiving, by a database platform, read access to a source directory in a data storage platform separate from the database platform. The method includes defining an external table based on the source directory. The method includes connecting the database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table. The method includes generating metadata for the external table, the metadata including information about data stored in the external table. The method includes receiving a notification that a modification has been made to the source directory, the modification including one or more of an insert, a delete, or an update. The method includes refreshing the metadata for the external table in response to the modification to the source directory.

[0242] Example 63 is a method according to Example 62, wherein generating metadata includes one or more of the following: defining cumulative table metadata for an external table; defining grouping expression properties for groupings of partitions in the external table; defining expression properties for partitions of the external table; defining partition statistics for partitions of the external table; or defining column expression properties for columns of partitions of the external table.

[0243] Example 64 is a method according to any one of Examples 62-63, further comprising storing the metadata in a partitioned storage object on a shared storage platform associated with the database platform, wherein the shared storage platform is separate from the data storage platform.

[0244] Example 65 is a method according to any one of Examples 62-64, wherein refreshing metadata includes one or more of the following: refreshing metadata in response to any modification made to the source directory; refreshing metadata within a threshold time period; refreshing metadata in response to a threshold number of modifications made to the source directory; or refreshing metadata in response to a client request to refresh the metadata.

[0245] Example 66 is a method according to any of Examples 62-65, further comprising reading a plurality of different file formats in a source directory.

[0246] Example 67 is a method according to any one of Examples 62-66, wherein receiving the notification includes one or more of the following: querying the data storage platform to determine whether any modifications have been made to the source directory; receiving a notification from the data storage platform that the source directory has been modified; or receiving a notification from a client associated with the source directory indicating that the source directory has been modified.

[0247] Example 68 is a method according to any one of Examples 62-67, wherein defining an external table based on a source directory includes: receiving an indication of a hierarchical structure in the source directory, the hierarchical structure defining folders and subfolders for data in the source directory; receiving an indication of a partition structure for the data in the source directory; and defining partitions in the external table based on a location within the hierarchical structure where the file is uploaded and further based on the partition structure.

[0248] Example 69 is a method according to any of Examples 62-68, wherein defining partitions in the external table includes generating metadata for the partitions in the external table and pointing the metadata to appropriate folders and subfolders in the source directory.

[0249] Example 70 is a method according to any of Examples 62-69, wherein receiving a notification comprises means for receiving a notification that a subfolder within the source directory has been modified.

[0250] Example 71 is a method according to any one of Examples 62-70, further comprising: identifying in an external table a specific partition corresponding to a specific subfolder within a source directory; and generating change tracking metadata for the specific partition indicating how the specific subfolder was modified and when the specific subfolder was modified.

[0251] Example 72 is a processor programmable to execute instructions stored in a non-transitory computer-readable storage medium, the instructions comprising: receiving, by a database platform, read access to a source directory in a data storage platform separate from the database platform; defining an external table based on the source directory; connecting the database platform to the external table so that the database platform has read access to the external table but does not have write access to the external table; generating metadata for the external table, the metadata including information about data stored in the external table; receiving a notification that a modification has been made to the source directory, the modification including one or more of an insert, a delete, or an update; and refreshing the metadata of the external table in response to the modification made to the source directory.

[0252] Example 73 is a processor according to Example 72, wherein generating metadata includes one or more of the following: defining cumulative table metadata for an external table; defining grouping expression attributes for groupings of partitions in the external table; defining expression attributes for partitions of the external table; defining partition statistics for partitions of the external table; or defining column expression attributes for columns of partitions of the external table.

[0253] Example 74 is a processor according to any one of Examples 72-73, wherein the instructions further include storing the metadata in a partitioned storage object on a shared storage platform associated with the database platform, wherein the shared storage platform is separate from the data storage platform.

[0254] Example 75 is a processor according to any one of Examples 72-74, wherein refreshing the metadata includes one or more of the following: refreshing the metadata in response to any modification made to the source directory; refreshing the metadata within a threshold time period; refreshing the metadata in response to a threshold number of modifications made to the source directory; or refreshing the metadata in response to a client request to refresh the metadata.

[0255] Example 76 is a processor according to any one of Examples 72-75, wherein defining an external table based on a source directory includes: receiving an indication of a hierarchical structure in the source directory, the hierarchical structure defining folders and subfolders for data in the source directory; receiving an indication of a partition structure for the data in the source directory; and defining partitions in the external table based on the location where the file is uploaded within the hierarchical structure and further based on the partition structure.

[0256] Various technologies or some aspects or parts thereof can be in the form of program codes (i.e., instructions) embodied in tangible media (such as floppy disks, CD-ROMs, hard disk drives, non-transitory computer-readable storage media, or any other machine-readable storage media), wherein when the program code is loaded into and executed by a machine such as a computer, the machine becomes a device for implementing various technologies. In the case of executing program codes on a programmable computer, a computing device may include a processor, a storage medium (including volatile and non-volatile memory and / or storage elements) readable by the processor, at least one input device, and at least one output device. Volatile and non-volatile memory and / or storage elements may be RAM, EPROM, flash memory, optical disk drives, magnetic hard disk drives, or other media for storing electronic data. One or more programs that may implement or utilize various technologies described herein may use application programming interfaces (APIs), reusable controls, etc. These programs may be implemented in high-level programs, functions, object-oriented programming languages ​​to communicate with a computer system. However, if necessary, one or more programs may be implemented in assembly language or machine language. In any case, the language may be a compiled or interpreted language and combined with a hardware implementation.

[0257] It should be understood that many of the functional units described in this specification can be implemented as one or more components, which is a term used to more specifically emphasize its implementation independence. For example, a component can be implemented as a hardware circuit including a customized very large scale integration (VLSI) circuit or gate array, an off-the-shelf semiconductor such as a logic chip, a transistor or other discrete component. A component can also be implemented in a programmable hardware device (such as a field programmable gate array, a programmable array logic, a programmable logic device, etc.).

[0258] Components may also be implemented in software so as to be executed by various types of processors. The identified components of executable code may, for example, include one or more physical or logical blocks of computer instructions, which may, for example, be organized as objects, programs, or functions. However, the executable files of the identified components need not be physically located together, but may include different instructions stored in different locations, which, when logically connected together, include the components and achieve the stated purpose of the components.

[0259] In practice, the components of executable code may be a single instruction or many instructions, and may even be distributed over several different code segments, different programs, and several memory devices. Similarly, operational data may be identified and described herein within the components, and may be embodied in any suitable form and organized within any suitable type of data structure. The operational data may be collected as a single data set, or may be distributed over different locations including different storage devices, and may exist at least in part only as electronic signals on a system or network. Components may be passive or active, including agents operable to perform desired functions.

[0260] References throughout this specification to "example" mean that a particular feature, structure, or characteristic described in conjunction with the example is included in at least one embodiment of the present disclosure. Therefore, the phrase "in an example" appearing in various places throughout this specification does not necessarily refer to the same embodiment.

[0261] As used herein, for convenience, multiple items, structural elements, constituent elements, and / or materials may be presented in a common list. However, these lists should be interpreted as if each member in the list were individually identified as an independent and unique member. Therefore, based solely on its presentation in a common group without an indication to the contrary, any individual member in such a list should not be interpreted as being in fact equivalent to any other member in the same list. In addition, various embodiments and examples of the present disclosure and alternatives to its various components may be referenced herein. It should be understood that these embodiments, examples, and alternatives should not be interpreted as de facto equivalents of each other, but should be regarded as separate and autonomous representations of the present disclosure.

[0262] Although the foregoing has been described in detail for the sake of clarity, it will be apparent that certain changes and modifications may be made without departing from its principles. It should be noted that there are many alternative ways to implement the processes and devices described herein. Therefore, the present embodiment should be considered illustrative rather than restrictive.

[0263] Those skilled in the art will appreciate that many changes may be made to the details of the above-described embodiments without departing from the underlying principles of the present disclosure.

Claims

1. A method, include: Receiving a query including one or more predicates, the query being directed at at least an external table stored in an external storage platform outside the database platform, the external table including multiple rows and multiple columns, the data in the external table being organized according to a hierarchical structure of a source directory of the external storage platform, the hierarchical structure including folders, subfolders and files, the data in the external table being arranged in the files, and the files being stored in the subfolders; receiving an indication of the hierarchical structure from a client; Based on the received indication of the hierarchical structure, generate metadata for the partitions in the external table and point the metadata to the subfolder in the source directory; determining, based on one or more predicates of the query and the metadata, that a given partition of the external table includes data that satisfies the query; identifying, based on the metadata, that a given partition of the external table corresponds to a given subfolder in the hierarchical structure; Retrieving data satisfying the query from a given subfolder corresponding to the given partition; as well as The query is responded to, at least in part, with the retrieved data.

2. The method according to claim 1, in, The external storage platform is separated from the database platform.

3. The method according to claim 1, further comprising: include: generating one or more materialized views according to the external table; storing the one or more materialized views in a data storage platform to which the database platform has write access; refreshing the one or more materialized views to reflect any changes made to the external table; generating a query plan for processing the query, the query plan comprising a plurality of discrete subtasks, the plurality of discrete subtasks comprising one or more tasks for scanning one or more of the one or more materialized views to find data satisfying the query, the plurality of discrete subtasks further comprising one or more tasks for scanning one or more partitions identified in the external table to find data satisfying the query; as well as Based on the metadata, assigning the plurality of discrete subtasks to one or more nodes in an execution platform to execute the query plan; The query is responded to at least in part by referencing one or more of the one or more materialized views.

4. The method according to claim 3, further comprising: include: identifying, based on the metadata, one or more partitions of internal database data that include data satisfying the one or more predicates, the internal database data being stored in the data storage platform to which the database platform has write access, The plurality of discrete subtasks further include one or more tasks for scanning one or more partitions identified in the internal database data to find data satisfying the query. 5 . The method of claim 4 , further comprising pruning all partitions of the internal database data that do not include data satisfying the query based on the metadata.

6. The method according to any one of claims 3 to 5, in, Allocating the plurality of discrete subtasks based on the metadata further comprises: reading the metadata to determine whether the first partition is stored in a cache of any of a plurality of nodes of the execution platform; and In response to storing the first partition in the cache of a specific node of the execution platform, a task for scanning the first partition is assigned to the specific node.

7. The method according to any one of claims 3 to 5, further comprising generating the metadata, in, The metadata includes information about the data stored in the external table, including one or more of the following: The accumulated table metadata of the external table; Partition statistics for partitions of the external table; and A list of columns expressing attributes of the partitions of the external table.

8. The method according to any one of claims 3 to 5, further comprising: include: receiving notification that a modification has been made to the external table; as well as The metadata is refreshed in response to modifications made to the external table.

9. The method of claim 8, the modification comprising one or more of adding a file, deleting a file, and updating a file in a source location of the external table.

10. The method of any one of claims 3 to 5, further comprising refreshing the metadata in response to a threshold number of modifications to the external table.

11. The method according to any one of claims 3 to 5, further comprising storing the metadata in a partitioned storage object on the data storage platform, to which the database platform has write access.

12. The method of any one of claims 3 to 5, further comprising pruning all partitions of the external table that do not include data satisfying the one or more predicates based on the metadata.

13. A system, include: at least one processor; as well as One or more computer-readable storage media containing instructions executable by the at least one processor to cause the at least one processor to perform operations including: Receiving a query including one or more predicates, the query being directed at at least an external table stored in an external storage platform outside the database platform, the external table including multiple rows and multiple columns, the data in the external table being organized according to a hierarchical structure of a source directory of the external storage platform, the hierarchical structure including folders, subfolders and files, the data in the external table being arranged in the files, and the files being stored in the subfolders; receiving an indication of the hierarchical structure from a client; generating metadata for partitions in the external table based on the received indication of the hierarchical structure, and pointing the metadata to subfolders in the source directory; determining, based on one or more predicates of the query and the metadata, that a given partition of the external table includes data that satisfies the query; identifying, based on the metadata, that a given partition of the external table corresponds to a given subfolder in the hierarchical structure; Retrieving data satisfying the query from a given subfolder corresponding to the given partition; as well as The query is responded to, at least in part, with the retrieved data.

14. The system according to claim 13, in, The external storage platform is separate from the database platform.

15. The system of claim 13, wherein the operation further comprises: include: generating one or more materialized views according to the external table; storing the one or more materialized views in a data storage platform to which the database platform has write access; refreshing the one or more materialized views to reflect any changes made to the external table; generating a query plan for processing the query, the query plan comprising a plurality of discrete subtasks, the plurality of discrete subtasks comprising one or more tasks for scanning one or more of the one or more materialized views to find data satisfying the query, the plurality of discrete subtasks further comprising one or more tasks for scanning one or more partitions identified in the external table to find data satisfying the query; as well as Based on the metadata, assigning the plurality of discrete subtasks to one or more nodes in an execution platform to execute the query plan; The query is responded to at least in part by referencing one or more of the one or more materialized views.

16. The system of claim 15, wherein the operation further comprises: include: identifying, based on the metadata, one or more partitions of internal database data that include data satisfying the one or more predicates, the internal database data being stored in the data storage platform to which the database platform has write access, The plurality of discrete subtasks further include one or more tasks for scanning one or more partitions identified in the internal database data to find data satisfying the query.

17. The system of claim 16, the operations further comprising pruning all partitions of the internal database data that do not include data satisfying the query based on the metadata.

18. A system according to any one of claims 15 to 17, in, Allocating the plurality of discrete subtasks based on the metadata further comprises: reading the metadata to determine whether the first partition is stored in a cache of any of a plurality of nodes of the execution platform; and In response to the first partition being stored in the cache of a specific node of the execution platform, a task for scanning the first partition is assigned to the specific node.

19. The system of any one of claims 15 to 17, the operations further comprising generating the metadata, in, The metadata includes information about the data stored in the external table, including one or more of the following: The accumulated table metadata of the external table; Partition statistics for partitions of the external table; and A list of columns expressing attributes of the partitions of the external table.

20. The system according to any one of claims 15 to 17, wherein the operation further include: receiving notification that a modification has been made to the external table; as well as The metadata is refreshed in response to modifications made to the external table.

21. The system of claim 20, the modification comprising one or more of adding a file, deleting a file, and updating a file in a source location of the external table.

22. The system of any one of claims 15 to 17, the operations further comprising refreshing the metadata in response to a threshold number of modifications to the external table.

23. The system according to any one of claims 15 to 17, wherein the operation further include: The metadata is stored in a partitioned storage object on the data storage platform to which the database platform has write access.

24. The system according to any one of claims 15 to 17, wherein the operation further include: Based on the metadata, all partitions of the external table that do not include data satisfying the one or more predicates are pruned.

25. One or more computer-readable storage media storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising: Receiving a query including one or more predicates, the query being directed at at least an external table stored in an external storage platform outside the database platform, the external table including multiple rows and multiple columns, the data in the external table being organized according to a hierarchical structure of a source directory of the external storage platform, the hierarchical structure including folders, subfolders and files, the data in the external table being arranged in the files, and the files being stored in the subfolders; receiving an indication of the hierarchical structure from a client; generating metadata for partitions in the external table based on the received indication of the hierarchical structure, and pointing the metadata to subfolders in the source directory; determining, based on one or more predicates of the query and the metadata, that a given partition of the external table includes data that satisfies the query; identifying, based on the metadata, that a given partition of the external table corresponds to a given subfolder in the hierarchical structure; Retrieving data satisfying the query from a given subfolder corresponding to the given partition; as well as The query is responded to, at least in part, with the retrieved data.

26. The computer-readable storage medium of claim 25, in, The external storage platform is separated from the database platform.

27. The computer-readable storage medium of claim 25, wherein the operation further comprises: include: generating one or more materialized views according to the external table; storing the one or more materialized views in a data storage platform to which the database platform has write access; refreshing the one or more materialized views to reflect any changes made to the external table; generating a query plan for processing the query, the query plan comprising a plurality of discrete subtasks, the plurality of discrete subtasks comprising one or more tasks for scanning one or more of the one or more materialized views to find data satisfying the query, the plurality of discrete subtasks further comprising one or more tasks for scanning one or more partitions identified in the external table to find data satisfying the query; as well as Based on the metadata, assigning the plurality of discrete subtasks to one or more nodes in an execution platform to execute the query plan; The query is responded to at least in part by referencing one or more of the one or more materialized views.

28. The computer-readable storage medium of claim 27, wherein the operation further comprises: include: identifying, based on the metadata, one or more partitions of internal database data that include data satisfying the one or more predicates, the internal database data being stored in the data storage platform to which the database platform has write access, The plurality of discrete subtasks further include one or more tasks for scanning one or more partitions identified in the internal database data to find data satisfying the query.

29. The computer-readable storage medium of claim 28, the operations further comprising pruning all partitions of the internal database data that do not include data satisfying the query based on the metadata.

30. The computer-readable storage medium according to any one of claims 27 to 29, in, Allocating the plurality of discrete subtasks based on the metadata further comprises: reading the metadata to determine whether the first partition is stored in a cache of any of a plurality of nodes of the execution platform; and In response to the first partition being stored in the cache of a specific node of the execution platform, a task for scanning the first partition is assigned to the specific node.

31. The computer-readable storage medium of any one of claims 27 to 29, the operations further comprising generating the metadata, in, The metadata includes information about the data stored in the external table, including one or more of the following: The accumulated table metadata of the external table; Partition statistics for partitions of the external table; and A list of columns expressing attributes of the partitions of the external table.

32. The computer-readable storage medium according to any one of claims 27 to 29, wherein the operation further include: receiving notification that a modification has been made to the external table; as well as The metadata is refreshed in response to modifications made to the external table.

33. The computer-readable storage medium of claim 32, the modification comprising one or more of adding a file, deleting a file, and updating a file in a source location of the external table.

34. The computer-readable storage medium of any one of claims 27 to 29, the operations further comprising refreshing the metadata in response to a threshold number of modifications to the external table.

35. The computer-readable storage medium according to any one of claims 27 to 29, wherein the operation further include: The metadata is stored in a partitioned storage object on the data storage platform to which the database platform has write access.

36. The computer-readable storage medium according to any one of claims 27 to 29, wherein the operation further include: Based on the metadata, all partitions of the external table that do not include data satisfying the one or more predicates are pruned.