Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6R1spapM7nBteaqeo
24 lines
1.3 KiB
Plaintext
24 lines
1.3 KiB
Plaintext
# N+1 on a lazy collection: 10 authors, 3 books each
|
|
# Hibernate ORM 7.4.16.Final, datasource-proxy 1.11.1, H2, JDK 25
|
|
|
|
== Code: one HQL query, then a.getBooks().size() for every author
|
|
books counted by the loop : 30
|
|
datasource-proxy SELECT count : 11
|
|
Hibernate prepareStatementCount : 11
|
|
Hibernate queryExecutionCount : 1
|
|
Hibernate collectionFetchCount : 10
|
|
Hibernate collectionLoadCount : 10
|
|
|
|
== The statements, in order
|
|
sql> select a1_0.id,a1_0.name from Author a1_0
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|
|
sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
|