Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement a catalogue for meta-data and automating SQL in a database?

Tags:

I have read here the discussions on 5NF, EAV and 6NF and the need for a catalogue to handle meta-data and the complex SQL "automatically". How is that implemented in practice?

PerformanceDBA wrote several answers on 6NF and EAV that mentions catalogues, e.g. in the following questions:

  • Would like to Understand 6NF with an Example

  • 6NF and historical attribute data

  • and especially Multiple fixed tables vs flexible abstract tables, where PerformanceDBA wrote

    "Eg. For 6NF databases with a catalogue, I have a set of procs that will [re]generate the SQL required to perform all SELECTs, and I provide Views in 5NF for all users, so they do not need to know or understand the underlying 6NF structure. They are driven off the catalogue. Thus changes are easy and automated. EAV types do that manually, due to the absence of the catalogue."

like image 217
Idonodi Avatar asked Aug 25 '12 09:08

Idonodi


People also ask

What is catalog in SQL database?

The system catalog consists of tables describing the structure of objects such as databases, base tables, views, and indices. (These tables are called system base tables.) The Database Engine frequently accesses the system catalog for information that is essential for the system to function properly.

How can SQL Server based applications access the information in system catalog?

Catalog views return information that is used by the SQL Server Database Engine. We recommend that you use catalog views because they are the most general interface to the catalog metadata and provide the most efficient way to obtain, transform, and present customized forms of this information.

What is meta data SQL?

Metadata, as most of you may already know, provides the basic and relevant information about the data. Metadata functions in SQL Server return information about the database, database objects, database files, file groups etc. in SQL Server.

What is metadata management in SQL Server?

Metadata management tool is a solution that supplements the data stored by the enterprise environment with useful information. Proper metadata management is a crucial factor to make information searchable, easy to locate and understand.


1 Answers

First, with LedgerSMB we reuse the system catalogs and information schema wherever we can. This means that the application actually spends some time querying the system catalogs. We also have some meta-data calculations for extended attributes. We don't do EAV here. Rather we have actual relations and meta-data about these which allows us to create relational queries on the client side. These are loaded at one point and cached. The catalog looks very much like an EAV catalog, but the underlying storage is actually relational and the functions which maintain these alter underlying tables. This gives you the flexibility of EAV without the underlying difficulties.

In future versions we will probably move to fewer application catalogs and greater use of the Pg system catalogs and information schema, and our interface will be simpler from an application perspective.

like image 128
Chris Travers Avatar answered Sep 19 '22 13:09

Chris Travers