Quoting Rickard Öberg <[email protected]>:

* What is the "PK" column for? Isn't it enough with the identity
one?

This idea is to have a PrimaryKey column generated by a sequence in
the underlying database to prevent concurency issues and to keep the
db index small and fast. Curently the PK is generated in java code
until we sort out entitystore/indexing syncronism. I'll let Stanislav
answer more precisely on this one if needed.

When is it used? Why does it have to be indexed?


Well it is faster to have BIGINT as table primary key, instead of VARCHAR(infty). It is used, for example, when adding new entities. It is also used in associations and many-associations - instead of referencing entity by identity-string, it is referenced by entity primary key (BIGINT). Additionally, each qualified name in its own table references entity through the primary key.

Primary key is not exactly indexed - it just is there so that it could be referenced from other tables instead of using potentially very long string, which may be replicated all over the database, as pretty much every table references entity in some way.


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to