~/talk

Thoughts about layered architecture – Mapping efficiently with SQL

Talkat Spring I/O 2022 · 2022-05-26..05-27· [databases, software-architecture]
links:none on file
slides:none on file

Argues that reading performance improves by pushing transforms into SQL instead of mapping JPA entities through service mappers, demonstrates using Spring Data projections and optionally jOOQ, replaces a mapper chain that fires 120,000 lazy subselects and causes ~10 minute requests with a 200-line SQL with CTEs that returns the same aggregates in about 3 seconds, and reports smaller gains in typical endpoints (about 72 ms down to 50 ms) while noting added SQL maintenance cost.

AI-written summary · about

  1. 0:00Intro
  2. 0:53KEEP THIS IN MIND
  3. 2:13I SAW A RECURRING PATTERN!
  4. 4:53DATA ACCESS
  5. 5:58DATA TRANSFORMATION
  6. 8:24WHAT I FOUND IN "THE ARCHIVES"
  7. 10:39WHAT IS LAYERED ARCHITECTURE?
  8. 11:11WHAT IS ENTERPRISE SOFTWARE?
  9. 11:46WHAT IS LAYERING?
  10. 17:10THIS IS HOW WE BUILD APPS
  11. 18:14REMEMBER THIS?
  12. 18:42IT IS OKAY TO SKIP LAYERS
  13. 19:39SUMMARY: GOALS OF LAYERING
  14. 21:01DISCLAIMER!
  15. 21:41DISPLAYING ALBUM INFORMATION
  16. 22:17HOW THE DATA IS STORED
  17. 23:26LET'S ADD A FIELD TO "ALBUM"
  18. 25:52WHAT DATA DO WE NEED?
  19. 26:21DON'T FETCH EVERYTHING
  20. 27:20WE DON'T KNOW!
  21. 29:37BENEFITS AND DOWNSIDES THE BAD
  22. 30:17MAPPING WITH SQL!
  23. 30:52FETCH DATA WITH PROJECTIONS
  24. 31:30CONVERSIONS IN THE DATABASE
  25. 32:55OF COURSE JOOQ IS MENTIONED
  26. 34:52REPO IN THE CONTROLLER
  27. 35:27NON-REPRESENTATIVE METRICS
  28. 37:00IMAGINE HAVING 200 OF THESE
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.