Bird
0
0

What is the effect of setting SQLALCHEMY_POOL_RECYCLE to 1800 in Flask-SQLAlchemy?

medium📝 Predict Output Q5 of 15
Flask - Performance Optimization
What is the effect of setting SQLALCHEMY_POOL_RECYCLE to 1800 in Flask-SQLAlchemy?
AThe pool recycles connections every 1800 requests
BConnections older than 1800 seconds are recycled to avoid stale connections
CThe pool size is limited to 1800 connections
DConnections are closed immediately after 1800 queries
Step-by-Step Solution
Solution:
  1. Step 1: Understand SQLALCHEMY_POOL_RECYCLE purpose

    This setting recycles connections older than the given seconds to prevent stale or timed-out connections.
  2. Step 2: Interpret the value 1800

    1800 seconds means connections older than 30 minutes will be closed and replaced.
  3. Final Answer:

    Connections older than 1800 seconds are recycled to avoid stale connections -> Option B
  4. Quick Check:

    Pool recycle = close old connections [OK]
Quick Trick: Recycle closes connections older than set seconds [OK]
Common Mistakes:
MISTAKES
  • Confusing recycle with pool size
  • Thinking recycle counts requests not time
  • Assuming immediate close after queries

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes