Mailinglist Archive: zypp-devel (68 mails)

< Previous Next >
[zypp-devel] storing texts in the database
  • From: Duncan Mac-Vicar Prett <dmacvicar@xxxxxxx>
  • Date: Thu, 10 May 2007 14:20:52 +0200
  • Message-id: <200705101420.53264.dmacvicar@xxxxxxx>

We are facing one problem.

The Shr tag in YaST metadata allows for multiple packages to share some data. 
Basically any data the package does not specify some metadata, it is taken 
from the package specified in the Shr tag.

We are trying to support sharing data in the database, to save space. This is 
normally achieved normalizing the tables, but this affects the cache write 
operation really slow.

To support it in this way, it could be saved in a separate table like:

CREATE TABLE text_attributes (
    id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  , attribute_code INTEGER
  , lang_code INTEGER
  , text TEXT
)

CREATE TABLE resolvable_text_attributes (
    resolvable_id INTEGER REFERENCES resolvable(id)
  , text_attribute_id INTEGER REFERENCES text_attribute(id)
  , PRIMARY KEY ( resolvable_id, text_attribute_id )
)

Then 2 resolvables can share attributes, and you can have any attribute in 
different languages. And you can share What is the problem? that means each 
attribute is inserted in a separate insert. (Not not mention we need to enum 
all Resolvable attributes ). Here comes two questions:

- Can a resolvable share all text attributes except one? How often does that 
happens?
- Can a translation include some attributes and some not for a resolvable? How 
often?

Both questions seems to answer themselfes. It is not very probable. And in the 
case it happens, it is better to duplicate the information.

So, what about this:

CREATE TABLE text_attributes (
    id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
  , lang_code INTEGER
  , summary TEXT
 , description TEXT
 , .... more
)

CREATE TABLE resolvable_text_attributes (
    resolvable_id INTEGER REFERENCES resolvable(id)
  , text_attribute_id INTEGER REFERENCES text_attribute(id)
  , PRIMARY KEY ( resolvable_id, text_attribute_id )
)

This needs only one insert. In the case 2 packages share a set of translated 
text attributes (all) in a language, they can share the record. In the rare 
case one attributed is not shared, you can duplicate the record.

Thoughts?

-- 
Duncan Mac-Vicar Prett  
Novell :: SUSE R&D, Maxfeldstr. 5, 90409 Nürnberg
TF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages