- Newest
- Most votes
- Most comments
To address the 1 MB response limit issue you're encountering with the RDS Data API when using Aurora PostgreSQL as a vector database for Bedrock knowledge bases, there are a few approaches you can take for monitoring and limiting the response size:
-
Monitoring: You can use Amazon Aurora's Performance Insights to monitor RDS Data API queries. In the Performance Insights dashboard, Data API queries are labeled as "RDS Data API". For Aurora PostgreSQL, these queries will have an "application_name" value of "rds-data-api". This can help you identify which queries are causing large result sets.
-
Limiting response size: To avoid exceeding the 1 MB limit, you can modify your queries to return smaller result sets. Here are some strategies:
a. Use the LIMIT clause in your SQL queries to restrict the number of rows returned. b. Be selective about the columns you're retrieving, only requesting the data you actually need. c. If you need to retrieve large amounts of data, consider breaking it up into multiple smaller queries using pagination techniques.
-
Adjusting database parameters: For Aurora PostgreSQL, you can adjust the 'track_activity_query_size' parameter to control how much SQL text is captured. The maximum value for this parameter is 1 MB for PostgreSQL version 13 and higher. While this won't directly solve your 1 MB response limit issue, it can help you capture more information about the queries causing the problem.
-
Error handling: Implement error handling in your application to catch these size limit errors. When you encounter the error, you can try to rerun the query with more restrictive parameters or break it into smaller chunks.
-
Alternative approaches: If you frequently need to return large result sets, you might want to consider alternative approaches to using the Data API, such as direct database connections or using other AWS services that can handle larger data transfers.
Remember, the 1 MB limit is a hard limit of the RDS Data API, so ultimately, your goal should be to ensure your queries return less than 1 MB of data per call.
Sources
Using RDS Data API - Amazon Aurora
Monitoring RDS Data API queries with Performance Insights - Amazon Aurora
ExecuteStatement - RDS Data API
Setting the SQL text limit for Aurora PostgreSQL DB instances - Amazon Aurora
answered 2 years ago
Relevant content
asked 2 years ago

I don't think you can LIMIT by size. However, you LIMIT by number of rows. How many rows are you currently returning?