Polyglot DBMS Static Analysis Copy Avoidance
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing polyglot database management systems incur inefficiencies due to the need for defensive copying of retrieved data to prevent dangling references, which leads to wasteful use of time and space.
Innovation Solution
The implementation of static analysis techniques to selectively avoid copying retrieved data into memory managed by a guest language runtime environment, by detecting cases where the lifetime of programming language references cannot exceed the lifetime of database content within a memory buffer.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If all retrieved values are unconditionally copied into memory managed by guest language runtime environment, then dangling references are prevented, but time and space are wasted due to copying values with short lifetimes
Solution Approach 1:
The system changes the parameter of memory management by introducing a hybrid approach where some values are copied to guest-managed memory while others remain in database-managed buffer. This is controlled by analyzing lifetime parameters of references to determine which values require copying and which can safely remain uncopied.
Solution Approach 2:
Different quality of memory management is applied to different values based on their lifetime characteristics. Values with short lifetimes that cannot exceed the buffer lifetime are kept in the database buffer without copying, while values with longer lifetimes are copied to guest-managed memory. This local differentiation eliminates unnecessary copying overhead.
2Reliability
If all retrieved values are unconditionally copied into memory managed by guest language runtime environment, then dangling references are prevented, but space is wasted due to copying values with short lifetimes
Solution Approach 1:
The system changes the parameter of memory allocation by introducing a hybrid approach where some values are copied to guest-managed memory while others remain in database-managed buffer. This is controlled by analyzing lifetime parameters of references to determine which values require copying and which can safely remain uncopied.
Solution Approach 2:
Different quality of memory management is applied to different values based on their lifetime characteristics. Values with short lifetimes that cannot exceed the buffer lifetime are kept in the database buffer without copying, while values with longer lifetimes are copied to guest-managed memory. This local differentiation eliminates unnecessary memory allocation and garbage collection overhead.
3Productivity
If static analysis is used to detect references with lifetimes not exceeding buffer lifetime, then copying is avoided for those references, but system complexity increases
Solution Approach 1:
The system replaces the mechanical approach of unconditional copying with a static analysis-based decision mechanism. The compiler performs static analysis on the guest language code to determine the lifetime of references, substituting the simple but wasteful copying mechanism with an intelligent selection process that avoids unnecessary copies while maintaining correctness.
Data Source
AI summary
In a computer embodiment, in a polyglot database management system (DBMS) that contains a guest language runtime environment, a database buffer is configured that the guest language runtime environment does not manage. In the polyglot DBMS, logic that is defined in a guest language is invoked to retrieve, into the database buffer, a value stored in a database in the polyglot DBMS. Compiling the logic causes semantic analyzing the logic to detect that usage of the retrieved value cannot occur after the retrieved value is overwritten in the database buffer. When detecting that such usage of the retrieved value cannot occur, the logic is executed without, after the retrieved value is overwritten in the database buffer, retaining a copy of the retrieved value in a memory region that the guest language runtime environment manages.


