This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Choose the best answer for the following questions:
Your AI application needs to store conversation metadata with varying structures. Some conversations include custom fields like model configuration, while others have user preferences. Which PostgreSQL data type best supports this requirement?
TEXT
JSONB
VARCHAR(MAX)
You insert a new conversation record and need the auto-generated ID immediately to insert related messages. Which PostgreSQL clause retrieves the generated value without a separate query?
RETURNING
OUTPUT
SELECT LAST_INSERT_ID()
You need to insert a user preference record. If the record already exists, you want to update the value without creating a duplicate. Which PostgreSQL clause handles this scenario?
INSERT INTO table ON DUPLICATE KEY UPDATE
INSERT INTO table ON CONFLICT DO UPDATE
INSERT INTO table IF NOT EXISTS
Your Python application creates many short-lived database connections to store individual messages during AI inference. What approach should you use to improve performance?
Open a new connection for each message and close it immediately after
Use a ConnectionPool to maintain reusable connections that the application can borrow and return
Keep a single global connection open for the entire application lifetime
You're designing a table for AI agent task checkpoints. Tasks have a status that should only be 'pending', 'in_progress', 'completed', or 'failed'. Which constraint enforces this rule at the database level?
UNIQUE (status)
CHECK (status IN ('pending', 'in_progress', 'completed', 'failed'))
NOT NULL DEFAULT 'pending'
You must answer all questions before checking your work.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?