Hibernate + MySQL. Ways to optimize selecting and loading data -


i'd test how selecting , loading data in java application using hibernate , mysql can optimized.

i divided results found 2 groups

mysql

  • indexes - sure
  • stored procedures - there difference if select done in stored procedure?
  • views - there difference if select definition kept in view?
  • query cache - work if same select second time?

hibernate

  • hibernate cache - similar query cache? how can configured?
  • lazy loading - can help?

are there other ways? use simple queries several joins , aggregation functions. need demonstate time changes between "before" , "after" optimization.

for more information tried read this, language complicated me.

  1. batch fetching important when read e.g. collection. in case hibernate can many rows of collection in 1 sql request, faster.
  2. hibernate caching solution (read ehcache instance) can store retrieved data on memory , if nothing changes on side can retrieve without asking sql engine what's going on there.
  3. lazy loading must 1 many associations (you can kill solution without this). fortunately set default in hibernate such associations.

you can read optimistic lock, faster pessimistic lock in many cases.

last not least should use proper transaction strategy, shouldn't create new transactions when not necessary.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -