On Efficiently Implementing SchemaSQL on an SQL Database System

Laks V. S. Lakshmanan, Fereidoon Sadri, Subbu N. SubramanianVLDB 1999

Introduction

SchemaSQL is a powerful extension of SQL designed to bridge the gap between data and metadata. In traditional relational databases, table and column names are fixed structures, while the data resides within the rows. SchemaSQL breaks this "hard wall," allowing variables to range over schema labels just as easily as they do over data values. This paper explores a framework for implementing SchemaSQL efficiently on top of existing SQL database systems without requiring modifications to the underlying engine.

The Challenge: Schematic Disparity

A common problem in data integration is "schematic disparity." For instance, one database might store stock information in a single table with a ticker column, while another might use a separate table for each company (e.g., an ibm table and a msft table). Querying across these different structures using standard SQL is notoriously difficult and often requires complex, hard-coded application logic.

Input tables and SchemaSQL query demonstrating schematic disparity.

As shown in the figure above, SchemaSQL addresses this by allowing queries to treat table names (like ibm or msft) as variables. This enables a single query to consolidate information from multiple tables with varying structures.

The SchemaSQL Framework

The authors propose an extended logical algebra to handle the restructuring required by SchemaSQL. This algebra includes four primary operators:

  • Unfold: Converts values in a column into new column headers.
  • Fold: The inverse of unfold, turning column headers back into data values.
  • Split: Breaks a single table into multiple tables based on column values.
  • Unite: Merges multiple tables into one.

These operators act as the building blocks for transforming "schematically disparate" data into a uniform format.

Non-Intrusive Implementation Strategy

To ensure compatibility with existing systems like IBM DB2, the researchers developed a "non-intrusive" implementation strategy. Instead of modifying the database kernel, they implemented a middleware layer that translates SchemaSQL queries into a sequence of standard SQL statements.

This is achieved through "Iterated Operators" such as iSel (Iterated Selection) and iProj (Iterated Projection). These operators use standard SQL features—like cursors and ORDER BY clauses—to simulate the complex restructuring logic of the extended algebra. This approach allows SchemaSQL to run on any standard RDBMS while benefiting from the database's native optimization and indexing.

Experimental Results and Scalability

The implementation was tested using industry-standard TPC-D benchmarks and synthetic datasets. The results confirmed that the non-intrusive approach is highly feasible.

Restructured output view (XgeView) generated by the SchemaSQL engine.

Key findings from the experiments include:

  • Linear Scalability: Execution times for restructuring operations generally scaled linearly with the size of the input data.
  • Performance Trade-offs: While a "native" C++ implementation was faster due to lower overhead, the SQL-based middleware approach offers significantly easier deployment and integration with existing enterprise environments.
  • Efficiency: For a dataset of approximately 20,000 rows, complex restructuring tasks were completed within 30 to 100 seconds, demonstrating practical performance for many data warehousing applications.

Conclusion and Future Work

This research demonstrates that SchemaSQL can be effectively implemented as a layer on top of standard relational databases. By treating schema labels as data, the system provides a flexible and powerful way to integrate heterogeneous data sources. Future work aims to expand the system's capabilities to include complex aggregations across restructured columns and to develop a full cost-based optimizer to further enhance execution efficiency.

Summary updated

BibTeX
@inproceedings{lakshmanan1999efficiently,
  author = {Laks V. S. Lakshmanan and Fereidoon Sadri and Subbu N. Subramanian},
  title = {{On Efficiently Implementing SchemaSQL on an SQL Database System}},
  booktitle = {VLDB},
  year = {1999},
}
Figure