How can I *prevent* Hibernate from creating Indexes in the database?
CASE 1:
I have tables A and B, with primary keys a_id and b_id. A many-to-many relation table A_B links these two. The many-to-many relation table contains tuples (a_id, b_id). Hibernate generates three indexes: INDEX (a_id), INDEX (b_id), PRIMARY KEY (a_id, b_id). Can I disable the creation of the PRIMARY KEY, since it should never be needed?
The reason why I want to do this: The PRIMARY KEY is by far the largest index, because obviously the key space is very large. This leads to the situation that we have a table with 1.2 GB of data and 3.8 GB of indexes, so I want to get rid of the huge PRIMARY KEY index.
CASE 2:
We use JAVA inheritance. This leads to tables where the PRIMARY KEY is a FOREIGN KEY at the same time. In these situations, Hibernate generates both a PRIMARY KEY and an INDEX for the same field, which is redundant. For the same reasons as in CASE 1 I want to get rid of the redundant indexes.
Bottom line: In some cases I need to get rid of PRIMARY KEYS, in some cases foreign key indexes.
Unfortunately there seems to be no documentation at all on how to *not* index tables...
Of course I can just modify the schema by hand after exporting, but this is not a good solution.
Thanks!
Hibernate version:
3.3.1
Name and version of the database you are using:
MySQL 5.0 with MyISAM tables
|