WO2012129114A1 - Memory quota - Google Patents

Memory quota Download PDF

Info

Publication number
WO2012129114A1
WO2012129114A1 PCT/US2012/029508 US2012029508W WO2012129114A1 WO 2012129114 A1 WO2012129114 A1 WO 2012129114A1 US 2012029508 W US2012029508 W US 2012029508W WO 2012129114 A1 WO2012129114 A1 WO 2012129114A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
operator
query
queries
allocation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/US2012/029508
Other languages
French (fr)
Inventor
Sivaramakrishnan Narayanan
Florian Michael Waas
Joy Jie Kent
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
EMC Corp
Original Assignee
EMC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by EMC Corp filed Critical EMC Corp
Publication of WO2012129114A1 publication Critical patent/WO2012129114A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • G06F16/24554Unary operations; Data partitioning operations
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems

Definitions

  • This invention relates generally to databases, and more particularly to systems and methods for allocating memory in databases.
  • Databases are typically used to organize, store, and retrieve data.
  • a database query may potentially take significant system resources, such as processing power and memory.
  • One common error when performing a query on a large database is an "Out of memory” error. This error occurs when the system has run out of physical memory to perform an operation or operations.
  • FIG. 1 is a diagram of a database in accordance with some embodiments.
  • FIG. 2 is a diagram of a query tree in accordance with some embodiments.
  • FIG. 3 is a graph of a method to compute memoiy intensive allocations in accordance with some embodiments.
  • FIG. 4 is a flowchart of a method to process queries in accordance with some embodiments.
  • FIG. 5 is a flowchart of a method to process queries in accordance with some embodiments.
  • FIG. 6 is a flowchart of a method to process queries in accordance with some embodiments.
  • the present invention can be implemented in numerous ways, including as a process, an apparatus, a system, a device, a method, or a computer readable medium such as a computer readable storage medium or a computer network wherein computer program instructions are sent over optical or electronic communication links.
  • Applications may take the form of software executing on a general purpose computer or be hardwired or hard coded in hardware.
  • these implementations, or any other form that the invention may take, may be referred to as techniques.
  • the order of the steps of disclosed processes may be altered within the scope of the invention.
  • Databases typically handle many queries simultaneously. For example, an airline database may handle queries from thousands of users
  • a resource queue may include a total memory allocation and a cap on concurrent queries, among others. Queries coming from different types of users may be placed in different resource queues.
  • a company has a single database servicing three departments: Legal, Engineering, and Finance. It may be preferable to create three resource queues: One for legal, one for engineering, and one for finance. Depending on policy, the three resource queues may have dramatically different characteristics. If engineering had top priority, legal middle priority, and finance low priority, the engineering resource queue may have a total memory allocation of 1 GB, the legal resource queue may have 500MB, and the finance resource queue may have 100MB.
  • the engineering resource queue may be allowed five concurrent queries, while the legal and finance resource queries may be allowed two queries each. In this way, queries from engineering have a higher preference. Engineering queries are allocated more system resources so they are completed faster, and they are given more concurrent queries so more of them can be completed concurrently. [0018] Other applications of the resource query may include placing queries from "platinum customers" into a platinum customer resource queue, which may have more system resources than a "gold customers" resource queue.
  • the memory allocation of a resource queue may be user-defined. For example, a system administrator may decide that the engineering resource queue is allocated 1 GB of memory. However, there may be times that the system
  • the query may spill over to disk after it has used up all of its allocated memory.
  • FIG. 1 illustrates an example of resource queues in accordance with some embodiments.
  • Database 10 includes Data 100, Resource Queue A 102, Resource Queue B 104, and Resource Queue C 106.
  • Resource Queue A has three slots
  • Resource Queue B has two slots
  • Resource Queue C has three slots. Since Resource Queue A has three slots, up to three queries may be run concurrently on Resource Queue A. Similarly, since Resource Queue B has two slots, up to two queries may be run concurrently.
  • FIG. 5 illustrates a method to process queries in accordance with some embodiments.
  • a query is received.
  • a classification for the query is determined.
  • the query is assigned a resource queue based on the determined query classification.
  • the query is placed in the assigned resource queue.
  • the actual amount of concurrent queries may be limited by factors other than available slots, such as the amount of available memory. For example, suppose Resource Queue A is allotted 300MB of memory total. In some embodiments, suppose Resource Queue A is allotted 300MB of memory total.
  • the third query would be allocated less than 100MB of memory. If allowing a query to execute with less than 100MB allocated may be unsafe (e.g. high probability of returning an out of memory error), the system or administrator may decide not to run a third concurrent query until one of the first two queries finishes.
  • FIG. 1 illustrates Resource Queue A and C having the same amount of slots
  • the amount of memory allocated to each query within each queue may be different. For example, suppose Resource Queue A was allocated a total amount of 300MB, each of its queries may be allocated 100MB. However, Resource Queue C may have been a more important resource queue (e.g. "platinum" level customers' queues may be placed in this resource queue), and was allocated a total of 900MB. In this case, each of Resource Queue C's queries may be allocated 300MB. In some embodiments, it may be preferable to assign different slots different amounts of memory (e.g. first slot 40% of the total, second slot 30% of the total, and third slot 30% of the total).
  • a database optimizer may translate a query into an execution plan that includes a tree of operators. There may be several ways to execute a query, and the database optimizer may choose one of many execution plans based on policy or a cost model.
  • a user such as a system administrator, may inspect and influence an execution plan through several mechanisms. For example, the user may change certain parameters, such as the cost of scanning a table sequentially vs using an index for random access of the table.
  • a typical query tree may include many operators. Such operators include sort, hash join, filter, etc. Operators may be classified as memory intensive (MI) or non-memory intensive (NMI). Sequential Scan is a NMI operator. Sort, on the other hand, is a MI operator. This is especially true if the sort operator has to sort a large amount of data. In some embodiments, it may be beneficial to allocate different amounts of memory to different operators.
  • MI memory intensive
  • NMI non-memory intensive
  • Sequential Scan is a NMI operator.
  • Sort is a MI operator. This is especially true if the sort operator has to sort a large amount of data. In some embodiments, it may be beneficial to allocate different amounts of memory to different operators.
  • NMI operators may be assigned a pre-set memory allocation, while MI operators may be assigned a dynamic memory allocation. Since NMI operators require little memory to complete, their allocation may be set by a system administrator or some other user having sufficient authority. For example, in some embodiments, a system administrator may assign 1MB to each NMI operator. It should be noted that a system administrator may also determine which operators are classified as NMI, and which operators are classified as MI.
  • FIG. 4 illustrates a method to process queries in accordance with some embodiments.
  • a query tree is analyzed.
  • at least one operator is determined based on the query tree analysis.
  • a memory allocation is assigned for each of the at least one operator.
  • the assignment is stored in a storage device.
  • the assignment may be stored in a storage device, such as a physical hard disk, memory, a virtual hard disk, etc.
  • a resource queue may be allocated a specific amount of memory, and have a cap on the number of concurrent queries.
  • each query may be allocated roughly 200MB each. This is assuming that each of the five concurrent engineering queries is given equal amounts of memory. It should be noted that the queries need not be given equal amounts of memory.
  • each of the three MI operators may be allocated 50MB. This is assuming that each of the three MI operators is given equal amounts of memory. It should be noted that the MI operators need not be given equal amounts of memory. For example, SORT may be given more memory over a hash-join.
  • the following algorithm may be used to determine how much memory a MI operator should receive:
  • NMI amount of memory allocated for each NMI operator
  • kl number of MI operators in the query.
  • MI allocation may be calculated.
  • FIG. 2 illustrates a query tree in accordance with some embodiments.
  • Query Tree 20 includes NMI operators 200, 204 and 208, and MI operators 202 and 206.
  • the memory allocation information may be associated with each operator (e.g. NMI operator 200 may be associated with 10MB, MI operator 202 may be associated with 100MB, etc.). This memory allocation information may be stored as part of the execution plan in some embodiments.
  • the MI calculated may be insufficient. For example, suppose the MI calculated was 50MB, but the query ended up running out of memory and spilling to disk. In such cases, it may be preferable to raise X in order to accommodate the query and prevent it from spilling to disk. This may be
  • MI amount of memory allocated for each MI operator
  • MI amount of memory allocated for each NMI operator
  • k2 number of NMI operators in the query
  • kl number of MI operators in the query.
  • X may be computed analytically using a linear equation. However, in some embodiments, X may not be a linear function of MI. Rather, X may be a nonlinear function that may be proportionate to MI*kl +
  • the binary search algorithm may begin with a low, medium and high value X and compute Mi's using the algorithm. Based on the 3MIs and the target, the process is repeated with a smaller range of X. Thus, a desirable X may be calculated, and the resource query may be adjusted accordingly. For example, if X is calculated to be 100MB larger than the original value, X may be increased for subsequent similar queries.
  • FIG. 3 illustrates using the binary search algorithm in accordance with embodiments.
  • the Y-axis measures the amount of memory (MB) the MI operator is allowed (Op Memory axis).
  • the X-axis measures the amount of total memory (MB) the query is allowed (Query Memory).
  • the Y-axis measures MI and the X-axis measures X.
  • the value of X may be associated with a particular query.
  • X may be stored as part of a query plan's fingerprint, indicating that a query with a specific set and sequence of operators should be allocated this much memory.
  • the amount of memory allocated may be stored as part of the query's execution plan.
  • Each operator in the execution plan may be associated with a memory allocation that the operator is allowed to use.
  • FIG. 6 illustrates a method to process queries in accordance with some embodiments.
  • a query is performed with a first intensive memory allocation.
  • an indication that a memory intensive operator in the query spilled to a first storage device is received.
  • a resource queue memory allocation is adjusted based on the indication.
  • a second memory intensive allocation is computed based on the adjusted resource queue memory allocation.
  • the second memory intensive allocation is stored in a second storage device.
  • FIG. 6 illustrates only one adjustment of the memory intensive allocation, multiple readjustments may take place. For example, in some
  • the binary search algorithm may be used to recalculate the memory intensive allocation.
  • multiple readjustments may take place.
  • the binary search algorithm's first result may be too low, second result may be too high, third attempt may be too low, and so on.
  • multiple tries may be needed before an acceptable memory intensive allocation is computed. It is anticipated that a third, fourth, fifth, etc. memory intensive allocation may be computed based on many different resource queue memory allocations.
  • FIG. 6 illustrates an operator spilling to a first storage device, and the second memory intensive allocation in a second storage device
  • these two storage devices may be the same storage device.
  • a memory intensive operator may be spilled onto a hard disk, and the second memory intensive allocation calculated may be stored on the same hard disk.
  • steps may be subdivided or combined.
  • software written in accordance with the present invention may be stored in some form of computer-readable medium, such as memory or CD-ROM, or transmitted over a network, and executed by a processor.
  • a single storage device may be used, or several may be used to take the place of a single storage device.
  • the disclosed embodiments are illustrative and not restrictive, and the invention is not to be limited to the details given herein. There are many alternative ways of implementing the invention. It is therefore intended that the disclosure and following claims be interpreted as covering all such alterations and modifications as fall within the true spirit and scope of the invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method, article of manufacture, and apparatus for processing queries, comprising analyzing a query tree, determining at least one operator based on the query tree analysis, assigning a memory allocation for each of the at least one operator, and storing the assignment in a storage device. In some embodiments, a memory classification for each of the at least one operator is determined. In some embodiments, assigning a memory allocation for each of the at least one operator includes assigning a memory allocation based on the memory classification.

Description

MEMORY QUOTA
CROSS REFERENCE TO RELATED APPLICATIONS
[0001] This application claims priority to co-pending U.S. Patent Application
No. 13/051,986 for MEMORY QUOTA filed on March 18, 201 1, which is incorporated herein by reference for all purposes. This application is related to copending U.S. Patent Application No. 13/051,980 for RESOURCE QUEUES filed on March 18, 201 1, which is incorporated herein by reference for all purposes, and to copending U.S. Patent Application No. 13/051,995 for DYNAMIC ALLOCATION OF MEMORY FOR MEMORY INTENSIVE OPERATORS filed on March 18, 2011, which is incorporated herein by reference for all purposes.
FIELD OF THE INVENTION
[0002] This invention relates generally to databases, and more particularly to systems and methods for allocating memory in databases.
BACKGROUND OF THE INVENTION
[0003] Databases are typically used to organize, store, and retrieve data.
Recent advances in technology have allowed databases to store vast amounts of data. However, querying vast amounts of data presents many challenges.
[0004] Due to the large amount of data stored, a database query may potentially take significant system resources, such as processing power and memory. One common error when performing a query on a large database is an "Out of memory" error. This error occurs when the system has run out of physical memory to perform an operation or operations.
[0005] Conventional methods to guard against an "Out of memory" error include adding more physical memory, or reducing the amount of queries processed concurrently. However, conventional methods are either expensive, not scalable, or both. There is a need, therefore, for an improved method, article of manufacture, and apparatus for allocating memory in databases.
BRIEF DESCRIPTION OF THE DRAWINGS
[0006] The present invention will be readily understood by the following detailed description in conjunction with the accompanying drawings, wherein like reference numerals designate like structural elements, and in which:
[0007] FIG. 1 is a diagram of a database in accordance with some
embodiments.
[0008] FIG. 2 is a diagram of a query tree in accordance with some embodiments.
[0009] FIG. 3 is a graph of a method to compute memoiy intensive allocations in accordance with some embodiments.
[0010] FIG. 4 is a flowchart of a method to process queries in accordance with some embodiments.
[0011] FIG. 5 is a flowchart of a method to process queries in accordance with some embodiments.
[0012] FIG. 6 is a flowchart of a method to process queries in accordance with some embodiments.
DETAILED DESCRIPTION
[0013] A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. While the invention is described in conjunction with such embodiment(s), it should be understood that the invention is not limited to any one embodiment. On the contrary, the scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications, and equivalents. For the purpose of example, numerous specific details are set forth in the following description in order to provide a thorough understanding of the present invention. These details are provided for the purpose of example, and the present invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the present invention is not unnecessarily obscured.
[0014] It should be appreciated that the present invention can be implemented in numerous ways, including as a process, an apparatus, a system, a device, a method, or a computer readable medium such as a computer readable storage medium or a computer network wherein computer program instructions are sent over optical or electronic communication links. Applications may take the form of software executing on a general purpose computer or be hardwired or hard coded in hardware. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. In general, the order of the steps of disclosed processes may be altered within the scope of the invention.
[0015] An embodiment of the invention will be described with reference to a data storage system in the form of a storage system configured to store files, but it should be understood that the principles of the invention are not limited to this configuration. Rather, they are applicable to any system capable of storing and handling various types of objects, in analog, digital, or other form. Although terms such as document, file, object, etc. may be used by way of example, the principles of the invention are not limited to any particular form of representing and storing data or other information; rather, they are equally applicable to any object capable of representing information.
[0016] Databases typically handle many queries simultaneously. For example, an airline database may handle queries from thousands of users
simultaneously via the internet. Handling too many queries concurrently may lead to out of memory errors. If too many users submit queries concurrently, and the database processes those queries simultaneously, the database will run out of memory and the queries will not be completed. Another cause may be a malicious user generating queries with an intent to overload the database, or prevent others from using the database. Conventional databases do not differentiate between queries. In conventional databases, a query is just as valid as another. There is no precedence give to one query over another query, or more system resources given to one query than another query.
[0017] The enhanced techniques described herein differentiate queries by placing queries in a resource queue. In some embodiments, a resource queue may include a total memory allocation and a cap on concurrent queries, among others. Queries coming from different types of users may be placed in different resource queues. To illustrate, suppose a company has a single database servicing three departments: Legal, Engineering, and Finance. It may be preferable to create three resource queues: One for legal, one for engineering, and one for finance. Depending on policy, the three resource queues may have dramatically different characteristics. If engineering had top priority, legal middle priority, and finance low priority, the engineering resource queue may have a total memory allocation of 1 GB, the legal resource queue may have 500MB, and the finance resource queue may have 100MB. Further, the engineering resource queue may be allowed five concurrent queries, while the legal and finance resource queries may be allowed two queries each. In this way, queries from engineering have a higher preference. Engineering queries are allocated more system resources so they are completed faster, and they are given more concurrent queries so more of them can be completed concurrently. [0018] Other applications of the resource query may include placing queries from "platinum customers" into a platinum customer resource queue, which may have more system resources than a "gold customers" resource queue.
[0019] The memory allocation of a resource queue may be user-defined. For example, a system administrator may decide that the engineering resource queue is allocated 1 GB of memory. However, there may be times that the system
administrator underestimates, or otherwise allocates an insufficient amount of memory for a resource queue. In such cases, the query may spill over to disk after it has used up all of its allocated memory.
[0020] FIG. 1 illustrates an example of resource queues in accordance with some embodiments. Database 10 includes Data 100, Resource Queue A 102, Resource Queue B 104, and Resource Queue C 106. As illustrated in FIG. 1, Resource Queue A has three slots, Resource Queue B has two slots, and Resource Queue C has three slots. Since Resource Queue A has three slots, up to three queries may be run concurrently on Resource Queue A. Similarly, since Resource Queue B has two slots, up to two queries may be run concurrently.
[0021] FIG. 5 illustrates a method to process queries in accordance with some embodiments. In step 500, a query is received. In step 502, a classification for the query is determined. In step 504, the query is assigned a resource queue based on the determined query classification. In step 506, the query is placed in the assigned resource queue.
[0022] The actual amount of concurrent queries may be limited by factors other than available slots, such as the amount of available memory. For example, suppose Resource Queue A is allotted 300MB of memory total. In some
embodiments, this may translate to 100MB of memory per slot in Resource Queue A (300MB / 3 slots = 100MB / slot). However, if the first query takes more than 100MB of memory, and the second query is allocated 100MB, the third query would be allocated less than 100MB of memory. If allowing a query to execute with less than 100MB allocated may be unsafe (e.g. high probability of returning an out of memory error), the system or administrator may decide not to run a third concurrent query until one of the first two queries finishes.
[0023] Further, though FIG. 1 illustrates Resource Queue A and C having the same amount of slots, the amount of memory allocated to each query within each queue may be different. For example, suppose Resource Queue A was allocated a total amount of 300MB, each of its queries may be allocated 100MB. However, Resource Queue C may have been a more important resource queue (e.g. "platinum" level customers' queues may be placed in this resource queue), and was allocated a total of 900MB. In this case, each of Resource Queue C's queries may be allocated 300MB. In some embodiments, it may be preferable to assign different slots different amounts of memory (e.g. first slot 40% of the total, second slot 30% of the total, and third slot 30% of the total).
[0024] In some embodiments, a database optimizer may translate a query into an execution plan that includes a tree of operators. There may be several ways to execute a query, and the database optimizer may choose one of many execution plans based on policy or a cost model. A user, such as a system administrator, may inspect and influence an execution plan through several mechanisms. For example, the user may change certain parameters, such as the cost of scanning a table sequentially vs using an index for random access of the table.
[0025] A typical query tree may include many operators. Such operators include sort, hash join, filter, etc. Operators may be classified as memory intensive (MI) or non-memory intensive (NMI). Sequential Scan is a NMI operator. Sort, on the other hand, is a MI operator. This is especially true if the sort operator has to sort a large amount of data. In some embodiments, it may be beneficial to allocate different amounts of memory to different operators.
[0026] For example, in some embodiments, NMI operators may be assigned a pre-set memory allocation, while MI operators may be assigned a dynamic memory allocation. Since NMI operators require little memory to complete, their allocation may be set by a system administrator or some other user having sufficient authority. For example, in some embodiments, a system administrator may assign 1MB to each NMI operator. It should be noted that a system administrator may also determine which operators are classified as NMI, and which operators are classified as MI.
[0027] FIG. 4 illustrates a method to process queries in accordance with some embodiments. In step 400, a query tree is analyzed. In step 402, at least one operator is determined based on the query tree analysis. In step 404, a memory allocation is assigned for each of the at least one operator. In step 406, the assignment is stored in a storage device. In some embodiments, the assignment may be stored in a storage device, such as a physical hard disk, memory, a virtual hard disk, etc.
[0028] With the NMI operators' memory allocation set, it is now possible to determine how much memory the MI operators should be allocated. As discussed above, a resource queue may be allocated a specific amount of memory, and have a cap on the number of concurrent queries. Using the example above, if the engineering resource queue was allocated 1GB of memory, and had a cap of five concurrent queries, then each query may be allocated roughly 200MB each. This is assuming that each of the five concurrent engineering queries is given equal amounts of memory. It should be noted that the queries need not be given equal amounts of memory.
[0029] For ease of illustration, suppose 200MB must be shared among all the operators in an engineering query. Suppose the query contained fifty NMI operators and three MI operators. If the system administrator allocated 1MB per NMI operator, that would leave 150MB for the three MI operators. Thus, each of the three MI operators may be allocated 50MB. This is assuming that each of the three MI operators is given equal amounts of memory. It should be noted that the MI operators need not be given equal amounts of memory. For example, SORT may be given more memory over a hash-join.
[0030] In some embodiments, the following algorithm may be used to determine how much memory a MI operator should receive:
MI = (X - NMI * k2) / kl, where: MI = amount of memory allocated for each MI operator,
X = total amount of memory allocated for the query,
NMI = amount of memory allocated for each NMI operator,
k2 = number of NMI operators in the query, and
kl = number of MI operators in the query.
[0031] Since X and NMI may be pre-set by a system administrator, and k2 and kl are readily ascertainable by inspecting the execution plan in some
embodiments, MI allocation may be calculated.
[0032] FIG. 2 illustrates a query tree in accordance with some embodiments.
Query Tree 20 includes NMI operators 200, 204 and 208, and MI operators 202 and 206. In FIG. 2, k2 = 3, and kl = 2. Using the above equation, if a system
administrator set NMI to 10MB and X to 230MB, MI can be calculated as (230 - 10*3) 1 2 = 200 1 2 = 100MB. In some embodiments, the memory allocation information may be associated with each operator (e.g. NMI operator 200 may be associated with 10MB, MI operator 202 may be associated with 100MB, etc.). This memory allocation information may be stored as part of the execution plan in some embodiments.
[0033] In some cases, the MI calculated may be insufficient. For example, suppose the MI calculated was 50MB, but the query ended up running out of memory and spilling to disk. In such cases, it may be preferable to raise X in order to accommodate the query and prevent it from spilling to disk. This may be
accomplished by the system administrator, or the database itself can automatically adjust X for subsequent similar queries if a disk-spill is detected.
[0034] The above equation may be rearranged to solve for X. That is, in some embodiments:
X = MI*kl + NMI*k2, where:
X = total amount of memory allocated for the query,
MI = amount of memory allocated for each MI operator, MI = amount of memory allocated for each NMI operator, k2 = number of NMI operators in the query, and
kl = number of MI operators in the query.
[0035] In some embodiments, X may be computed analytically using a linear equation. However, in some embodiments, X may not be a linear function of MI. Rather, X may be a nonlinear function that may be proportionate to MI*kl +
NMI*k2. In some embodiments, it may be preferable to employ a binary search algorithm to find the optimal value of X. For example, the binary search algorithm may begin with a low, medium and high value X and compute Mi's using the algorithm. Based on the 3MIs and the target, the process is repeated with a smaller range of X. Thus, a desirable X may be calculated, and the resource query may be adjusted accordingly. For example, if X is calculated to be 100MB larger than the original value, X may be increased for subsequent similar queries.
[0036] FIG. 3 illustrates using the binary search algorithm in accordance with embodiments. The Y-axis measures the amount of memory (MB) the MI operator is allowed (Op Memory axis). The X-axis measures the amount of total memory (MB) the query is allowed (Query Memory). In terms of the above equations, the Y-axis measures MI and the X-axis measures X. As shown in FIG. 3, the MI operator requires roughly 15MB in order to avoid spilling over to disk. Since the relationship between MI and X is non-linear, the binary search algorithm is used to determine the appropriate X value. A first try may be X = 128MB. This results in MI being allocated about 7MB. This is less than the 15MB required, so a higher value of X may be chosen. A second try may be X = 300MB. As shown in the graph, this results in MI being allocated about 24MB. Although this would satisfy the MI operator, it may be undesirable to allocate too much memory to the MI operator. Since we now know 128MB < X < 300MB, we can further narrow the range using the same process. For example, the third guess may be X = 200, which would result in roughly MI = 13. This is closer to the required MI value. The binary search algorithm may be considered complete if the MI value calculated is within a pre-defined tolerance range. For example, if a system can tolerate MI = 15MB +/- 1MB, then a MI value of 16 would be acceptable, even though 1MB would be allocated and unused.
[0037] The value of X may be associated with a particular query. For example, X may be stored as part of a query plan's fingerprint, indicating that a query with a specific set and sequence of operators should be allocated this much memory. In some embodiments, the amount of memory allocated may be stored as part of the query's execution plan. Each operator in the execution plan may be associated with a memory allocation that the operator is allowed to use.
[0038] FIG. 6 illustrates a method to process queries in accordance with some embodiments. In step 600, a query is performed with a first intensive memory allocation. In step 602, an indication that a memory intensive operator in the query spilled to a first storage device is received. In step 604, a resource queue memory allocation is adjusted based on the indication. In step 606, a second memory intensive allocation is computed based on the adjusted resource queue memory allocation. In step 608, the second memory intensive allocation is stored in a second storage device.
[0039] Though FIG. 6 illustrates only one adjustment of the memory intensive allocation, multiple readjustments may take place. For example, in some
embodiments where the binary search algorithm is used to recalculate the memory intensive allocation, multiple readjustments may take place. The binary search algorithm's first result may be too low, second result may be too high, third attempt may be too low, and so on. Depending on the tolerance of a system, multiple tries may be needed before an acceptable memory intensive allocation is computed. It is anticipated that a third, fourth, fifth, etc. memory intensive allocation may be computed based on many different resource queue memory allocations.
[0040] Further, though FIG. 6 illustrates an operator spilling to a first storage device, and the second memory intensive allocation in a second storage device, these two storage devices may be the same storage device. For example, a memory intensive operator may be spilled onto a hard disk, and the second memory intensive allocation calculated may be stored on the same hard disk. [0041] For the sake of clarity, the processes and methods herein have been illustrated with a specific flow, but it should be understood that other sequences may be possible and that some may be performed in parallel, without departing from the spirit of the invention. Additionally, steps may be subdivided or combined. As disclosed herein, software written in accordance with the present invention may be stored in some form of computer-readable medium, such as memory or CD-ROM, or transmitted over a network, and executed by a processor.
[0042] All references cited herein are intended to be incorporated by reference. Although the present invention has been described above in terms of specific embodiments, it is anticipated that alterations and modifications to this invention will no doubt become apparent to those skilled in the art and may be practiced within the scope and equivalents of the appended claims. More than one computer may be used, such as by using multiple computers in a parallel or load- sharing arrangement or distributing tasks across multiple computers such that, as a whole, they perform the functions of the components identified herein; i.e. they take the place of a single computer. Various functions described above may be performed by a single process or groups of processes, on a single computer or distributed over several computers. Processes may invoke other processes to handle certain tasks. A single storage device may be used, or several may be used to take the place of a single storage device. The disclosed embodiments are illustrative and not restrictive, and the invention is not to be limited to the details given herein. There are many alternative ways of implementing the invention. It is therefore intended that the disclosure and following claims be interpreted as covering all such alterations and modifications as fall within the true spirit and scope of the invention.
[0043] WHAT IS CLAIMED IS:

Claims

1. A method for processing queries, comprising:
analyzing a query tree;
determining at least one operator based on the query tree analysis;
assigning a memory allocation for each of the at least one operator; and storing the assignment in a storage device.
2. The method as recited in claim 1, further comprising determining a memory classification for each of the at least one operator.
3. The method as recited in claim 2, wherein assigning a memory allocation for each of the at least one operator includes assigning a memory allocation based on the memory classification.
4. The method as recited in claim 2, wherein determining a memory
classification is based on the type of operator.
5. The method as recited in claim 4, wherein the determined memory classification is non-memory intensive.
6. The method as recited in claim 5, wherein the memory allocation is determined by a user.
7. The method as recited in claim 4, wherein the determined memory classification is memory intensive.
8. A system for processing queries, comprising a processor configured to analyze a query tree, determine at least one operator based on the query tree analysis, assign a memory allocation for each of the at least one operator, and store the assignment in a storage device.
9. A computer program product for processing queries, comprising a computer readable medium having program instructions embodied therein for:
analyzing a query tree;
determining at least one operator based on the query tree analysis;
assigning a memory allocation for each of the at least one operator; and storing the assignment in a storage device.
PCT/US2012/029508 2011-03-18 2012-03-16 Memory quota Ceased WO2012129114A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US13/051,986 US9418109B2 (en) 2011-03-18 2011-03-18 Memory quota
US13/051,986 2011-03-18

Publications (1)

Publication Number Publication Date
WO2012129114A1 true WO2012129114A1 (en) 2012-09-27

Family

ID=46829294

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2012/029508 Ceased WO2012129114A1 (en) 2011-03-18 2012-03-16 Memory quota

Country Status (2)

Country Link
US (1) US9418109B2 (en)
WO (1) WO2012129114A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10120902B2 (en) * 2014-02-20 2018-11-06 Citus Data Bilgi Islemleri Ticaret A.S. Apparatus and method for processing distributed relational algebra operators in a distributed database
CN112748850B (en) 2019-10-29 2024-04-19 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for storage management
CN115687352A (en) * 2022-11-03 2023-02-03 中国银联股份有限公司 A storage method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080075101A1 (en) * 2006-09-25 2008-03-27 Illikkal Ramesh G Quality of service implementation for platform resources

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002046916A2 (en) * 2000-10-20 2002-06-13 Polexis, Inc. Extensible information system (xis)
US7409517B2 (en) * 2001-10-01 2008-08-05 Oracle International Corporation Dynamic and automatic memory management
US9357033B2 (en) * 2003-06-17 2016-05-31 Citrix Systems, Inc. Method and system for dynamic interleaving
WO2007125942A1 (en) * 2006-04-26 2007-11-08 Nippon Telegraph And Telephone Corporation Load control device and its method
US8606997B2 (en) * 2008-12-23 2013-12-10 Oracle America, Inc. Cache hierarchy with bounds on levels accessed
US20100274893A1 (en) * 2009-04-27 2010-10-28 Sonus Networks, Inc. Methods and apparatus for detecting and limiting focused server overload in a network
US20120066444A1 (en) * 2010-09-14 2012-03-15 Advanced Micro Devices, Inc. Resolution Enhancement of Video Stream Based on Spatial and Temporal Correlation
US20120215764A1 (en) * 2011-02-17 2012-08-23 International Business Machines Corporation Energy usage and performance query governor

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080075101A1 (en) * 2006-09-25 2008-03-27 Illikkal Ramesh G Quality of service implementation for platform resources

Also Published As

Publication number Publication date
US9418109B2 (en) 2016-08-16
US20120239641A1 (en) 2012-09-20

Similar Documents

Publication Publication Date Title
US9372867B2 (en) Similarity analysis method, apparatus, and system
US10701140B2 (en) Automated ETL resource provisioner
US9529626B2 (en) Facilitating equitable distribution of thread resources for job types associated with tenants in a multi-tenant on-demand services environment
US8190598B2 (en) Skew-based costing for database queries
US20150178135A1 (en) Facilitating tiered service model-based fair allocation of resources for application servers in multi-tenant environments
US9836330B2 (en) Virtual resource management tool for cloud computing service
CN112753022A (en) Automatic query retry in a database environment
US20150317345A1 (en) Multiple fields parallel query method and corresponding storage organization
US11308066B1 (en) Optimized database partitioning
US9104663B1 (en) Dynamic allocation of memory for memory intensive operators
US20140019430A1 (en) Database management method, database management system, and processing program therefor
US20190236474A1 (en) Load balancing for distributed processing of deterministically assigned data using statistical analysis of block data
Talluri et al. Characterization of a big data storage workload in the cloud
EP3887971B1 (en) Scalable implementations of exact distinct counts and multiple exact distinct counts in distributed query processing systems
US9418109B2 (en) Memory quota
Tan et al. Effectiveness assessment of solid-state drive used in big data services
GB2504812A (en) Load balancing in a SAP (RTM) system for processors allocated to data intervals based on system load
CN114398105A (en) Method and device for loading data from distributed database by computing engine
US9418064B1 (en) Resource queues
Kleerekoper et al. A scalable implementation of information theoretic feature selection for high dimensional data
US12013848B2 (en) Systems and methods for managing queries from different types of client applications
CN103902686B (en) A kind of data duplicate removal method and device
Wang et al. Turbo: Dynamic and decentralized global analytics via machine learning
CN110069511B (en) Data query distribution method and device
US7721287B2 (en) Organizing transmission of repository data

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12760886

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12760886

Country of ref document: EP

Kind code of ref document: A1