Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Supercharging Node.js Applications with Sequelize

You're reading from   Supercharging Node.js Applications with Sequelize Create high-quality Node.js apps effortlessly while interacting with your SQL database

Arrow left icon
Product type Paperback
Published in Oct 2022
Publisher Packt
ISBN-13 9781801811552
Length 266 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniel Durante Daniel Durante
Author Profile Icon Daniel Durante
Daniel Durante
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Part 1 – Installation, Configuration, and the Basics
2. Chapter 1: Introduction to Sequelize and ORM in Node.js FREE CHAPTER 3. Chapter 2: Defining and Using Sequelize Models 4. Part 2 – Validating, Customizing, and Associating Your Data
5. Chapter 3: Validating Models 6. Chapter 4: Associating Models 7. Chapter 5: Adding Hooks and Lifecycle Events to Your Models 8. Chapter 6: Implementing Transactions with Sequelize 9. Chapter 7: Handling Customized, JSON, and Blob Data Types 10. Part 3 – Advanced Queries, Using Adapters, and Logging Queries
11. Chapter 8: Logging and Monitoring Your Application 12. Chapter 9: Using and Creating Adapters 13. Chapter 10: Deploying a Sequelize Application 14. Index 15. Other Books You May Enjoy

Querying associations with eager loading and lazy loading

Sequelize offers two different methods of querying associations depending on how you wish to query the data: eager loading and lazy loading. With eager loading, you would load all of the associated data at once. The lazy loading method will load the associations per query as they are called upon from the code. It is easier to explain eager loading than lazy loading but to see the benefits of eager loading, we will need to go over lazy loading first.

Note

You may have heard of the “N+1 select problem” with other ORM frameworks; this is referring to the lazy loading method (although, not mutually exclusive) and how selecting an association per row could be hazardous to your application’s performance.

Lazy loading

Sequelize tries to make no presumptions about your intent and will initially select only the model’s data. We will need to explicitly call the associations if we want to transverse...

lock icon The rest of the chapter is locked
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Supercharging Node.js Applications with Sequelize
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon