Summary
In this chapter, we have covered data persistence tuning from various points of view. In particular, we have started discussing database design techniques, then we have moved to plain JDBC programming, reaching the heart of the application server with JPA and Hibernate tuning. Summing up, the most important things learnt are resumed here:
Good database design depends on the type of application you are running.
Applications using lots of transactions benefit from database normalization because there is less data to change and thus reduced lock contention.
On the other hand, Online Analytical Processing systems (like report applications) are generally faster with a denormalized schema because they can benefit from faster queries.
Database schemas holding huge amount of records can perform much better if the data is partitioned.
A solid database design also requires a correct use of indexes. Generally, you should apply indexes to fields used in the
WHERE
clause. Consider, however, that too...