Hi,
I have a rather general question: Does it make sense, to use a db index on a discriminator column? I have the following annotations on a superclass that is extended by to sublcasses:
Code:
@Entity
@Table(name = "tblSubject")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@org.hibernate.annotations.Table(appliesTo="tblSubject", indexes={
@Index(name="tblSubject_idx_type", columnNames={"type"})})
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING, length = 4)
public abstract class Subject ....
Is this a common practice or is it better to omit the index when only 2 different values (i.e. the discriminator values of the 2 sub classes) can appear on the type column?
thx,
john