Personal tools

Difference between revisions of "Database structure"

From PhotoVoltaic Logger new generation

Jump to: navigation, search
m (Translations)
m
Line 2: Line 2:
 
[[Category:Internals]]
 
[[Category:Internals]]
 
== General ==
 
== General ==
 +
 +
Here is also the [http://pvlng.com/schema/index.html Database schema] generated by [http://schemaspy.sourceforge.net schemaSpy].
  
 
Here are the most important tables with their references:
 
Here are the most important tables with their references:

Revision as of 21:52, 25 March 2015

General

Here is also the Database schema generated by schemaSpy.

Here are the most important tables with their references:


DBStructure.png

Channel types

pvlng_type

DBTableType.png

Channels

pvlng_channel

DBTableChannel.png

Channel hierarchy

pvlng_tree

The channel tree is organized in a nested set structure.

The nested set model is a particular technique for representing nested sets (also known as trees or hierarchies) in relational databases.

The nested set model is to number the nodes according to a tree traversal, which visits each node twice, assigning numbers in the order of visiting, and at both visits. This leaves two numbers for each node, which are stored as two attributes. Querying becomes inexpensive: hierarchy membership can be tested by comparing these numbers. Updating requires renumbering and is therefore expensive.

Wikipedia:Nested set model

More theory about nested sets.


DBTableTree.png

Measuring data storage

pvlng_reading_num, pvlng_reading_str

DBTableReadingNum.png DBTableReadingStr.png

The difference between the reading tables is only the data format for reading values.

The timestamps are not stored as "normal" timestamp type, but as unsigned integer.

It was tested and have significant more performance for consolidated data readouts.

Dashboards

pvlng_dashboard

DBTableDashboard.png

Tariffs

pvlng_tariff

DBTableTariff.png

pvlng_tariff_date

DBTableTariffDate.png

pvlng_tariff_time

DBTableTariffTime.png

Charts

pvlng_view

DBTableView.png

Translations

pvlng_babelkit

Here are stored all translations for the web frontend based on the "BabelKit - Multilingual Code Description Lookup Table" [1] project.

DBTableBabelkit.png

The "changed" column is used to detect recently changed translations for upgrade SQLs