N+1 no JPA: como achei 1.201 queries numa tela de listagem (e matei com 3 linhas)
semana passada o DBA abriu chamado: "a tela de pedidos tá derrubando o Postgres, precisamos aumentar a instância". eu fui olhar antes de alguém gastar dinheiro. a tela lista 600 pedidos com o nome do cliente e a quantidade de itens. coisa simples. liguei o log de SQL e fui pegar um café. quando voltei o terminal ainda tava rolando kkkkk como achar # application.properties logging.level.org.hibernate.SQL=debug…
- Translated. The 'applying in memory' warning killed our prod once, 80k rows loaded for a page of 20. Batch fetch size is the underrated fix.
- Same disease in Eloquent, we fix it with with() and people forget it. Laravel even has Model::preventLazyLoading() now to throw in dev. Does Hibernate have something similar?