Other suggestions to clean DB...
I don't think you can restrict the subtitle to 255 characters. If a subtitle is longer than 255 characters, you have to have some way to store it. Also, if we store a unicode subtitle, you'd be restricting the title to only 127 characters. Newer mysql servers _can_ index blobs. I believe that you can set how many of the first characters of the blob are indexed. If you _have_ to support indexing of subtitles with older mysql servers, then maybe create a new subtitle_index table that contains the first 255 characters (or less) of the entries in the subtitle field. Note that with the MARC DB schema I'm using, if a value is less than 255 characters, it is stored directly in the Subfield_Value table, if it is longer, it is stored in a separate blob table. This means that will be necessary to generate and maintain separate indexes for searching purposes. Steve.
On Tue, 2002-03-05 at 23:48, paul POULAIN wrote: I'm working on putting pk on tables in the DB. I've a few other suggestions to do : * The bibliosubject table has a no indexes. It would be useful, imho, to put one on biblionumber, and one on subject, to speed up searches. The problem is that subject is a text field (BLOB), so can't be indexed. in the sample DB, there are only 3 record being more than 80car long. And they are, (again imho) unuseable for searches : WORLD WAR, 1939-1945 - PRISONERS AND PRISONS, GERMAN - PERSONAL NARRATIVES, NEW ZEALAND, for exampl. I had divided such a subject in 3 or 4 subjects. Do you agree to modify column type to car(80), and putting an index ? You can actually index text fields (It is indexed in the hlt database in production) show index from bibliosubject; +---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+---------+ | bibliosubject | 1 | subidx | 1 | subject | A | 17111 | 15 | NULL | | +---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+---------+ So for subjects etc, we can just put an index on. Without needing to modify column size * The borexp (expiration date) table seems to have a problem : there should be only 1 record for 1 borrower (the pk should be on borrowernumber), and for 2 dozens of borrowers, there are 2 records. Do you confirm it's a bug in the datas ? Yep * The borrowers table has the same problem : the 1000000624,1000001224 and 1000001225 are present twice (they are test borrowers ?). If they weren't, I could put a pk on * borrowernumber field. I can correct by deleting those records Yep Heres the indices i have on borrower show index from borrowers; +-----------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +-----------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+---------+ | borrowers | 0 | PRIMARY | 1 | borrowernumber | A | NULL | NULL | NULL | | | borrowers | 1 | borrowernumber | 1 | borrowernumber | A | NULL | NULL | NULL | | | borrowers | 1 | cardnumber | 1 | cardnumber | A | NULL | NULL | NULL | | | borrowers | 1 | suridx | 1 | surname | A | NULL | 12 | NULL | | | borrowers | 1 | firstidx | 1 | firstname | A | NULL | 12 | NULL | | +-----------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+---------+ * . * The aqorderbreakdown and issues, and reserves tables should have a pk, but due to trash in sample db, the alter table does'nt work. Uncleanable by script (too many errors). I will * in a lot of tables there are columns that should be "not null" defined, and that are not. I've corrected this to enable pk-ing. Once I will have answers to those questions, the bd-patch will be released very soon (script perl), and the admin tool will follow (i can't release it immedialty, because pk is needed. But it's mostly writen) Cool. I have realised over the last few days, my production database is quite different to the sample data. It has a ton more indices for a start. But ill be keen to see the patch and see what ive missed. Chris -- Chris Cormack Programmer 025 500 789 Katipo Communications Ltd chris@katipo.co.nz www.katipo.co.nz
Chris Cormack wrote:
I've a few other suggestions to do : * The bibliosubject table has a no indexes. It would be useful, imho, to put one on biblionumber, and one on subject, to speed up searches. The problem is that subject is a text field (BLOB), so can't be indexed. in the sample DB, there are only 3 record being more than 80car long. And they are, (again imho) unuseable for searches : WORLD WAR, 1939-1945 - PRISONERS AND PRISONS, GERMAN - PERSONAL NARRATIVES, NEW ZEALAND, for exampl. I had divided such a subject in 3 or 4 subjects. Do you agree to modify column type to car(80), and putting an index ?
You can actually index text fields (It is indexed in the hlt database in production) show index from bibliosubject; +---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+---------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment | +---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+---------+ | bibliosubject | 1 | subidx | 1 | subject | A | 17111 | 15 | NULL | | +---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+---------+
You're both right. I tried to index with phpmyadmin, who can't create this : CREATE INDEX test ON bibliosubtitle (subtitle(80)) If I create index in writing the create index, it works. So, this problem is closed. we can keep text fields. -- Paul
participants (3)
-
Chris Cormack -
paul POULAIN -
Tonnesen Steve