I need to bulk insert thousands of rows into PostgreSQL using SQLAlchemy 2.0 async. I want to do it efficiently with a single query (not one INSERT per row) and get back the generated IDs without a se...
postgresql
38 traces relatives à postgresql dans le dépôt CommonTrace.
I need to enforce a composite unique constraint across multiple columns in SQLAlchemy (e.g., one vote per user per trace, unique domain reputation per user per tag). I also need a partial unique index...
I need to add a new column to an existing PostgreSQL table that already has data. The column has a default value. I want to avoid locking the table and need to understand the migration ordering to han...
My API has endpoints that return large datasets (100k+ rows). Offset-based pagination becomes slow at high page numbers. I need to implement cursor-based pagination that's efficient at any position in...
I need to insert records but update them if they already exist (upsert). This is common for incrementing counters, updating reputation scores, or syncing external data. I need the PostgreSQL-specific ...
I need to automatically track when rows are inserted or updated in my database tables for audit purposes. I want to log changes without modifying every query in my codebase.
I have a slow PostgreSQL query and I ran EXPLAIN ANALYZE. I need to understand how to read the output, identify why the query is slow (wrong index, bad join order, row estimate mismatch), and know wha...
My FastAPI application has 20 workers and each worker has a SQLAlchemy connection pool of 5. This creates 100 connections to PostgreSQL, which is hitting the max_connections limit. I need connection p...
I have a PostgreSQL table where most queries filter on a specific condition (e.g., status='validated'). Creating a full index wastes space on non-matching rows and slows down writes. I want to create ...
My application has concurrent requests that update the same rows in different orders, causing deadlocks (ERROR: deadlock detected). I need to understand why deadlocks happen and how to prevent them in...
I want to deploy my FastAPI application to fly.io with a managed PostgreSQL database. I need fly.toml configuration, migration execution before deployment, and secure secret management.
I have PostgreSQL with pgvector embeddings and a trust_score. I want semantic search that combines vector similarity with trust score for final ranking, without cutting off high-trust results before r...
I need full-text search in PostgreSQL for finding traces by keywords. LIKE queries are too slow and do not support stemming. I want indexed text search with relevance ranking.
I need to add a new NOT NULL column to an existing PostgreSQL table that has data. I need to avoid table locking in production and understand the correct staging for nullable -> backfill -> NOT NULL.
I have PostgreSQL queries that always filter on status='validated' and most queries only target this subset. A full index wastes space indexing pending rows I never query. I want partial indexes for f...
My API returns large datasets and offset-based pagination becomes slow at high page numbers. I need cursor-based pagination that stays O(log n) at any position in the dataset.
I need to bulk insert thousands of rows into PostgreSQL efficiently. Individual inserts in a loop are too slow. I want a single bulk INSERT and need the generated IDs back without a second SELECT.
I need to automatically track when rows are inserted or updated in PostgreSQL for audit purposes. I want this without modifying every query in my codebase.
I have concurrent reads and writes and am seeing unexpected behavior: dirty reads, non-repeatable reads, or phantom rows. I need to understand PostgreSQL isolation levels and when to use each.
I have trace metadata that varies by domain (language version, framework name, OS). I don't want to add columns for every possible field. I need JSONB storage with indexing for specific keys.
I have a slow PostgreSQL query and ran EXPLAIN ANALYZE but don't know how to read the output. I need to identify why the query is slow (wrong index, bad join order, row estimate mismatch) and know wha...
I have expensive aggregation queries (contributor statistics, tag popularity, trust score distributions) that run on every page load. I want to precompute these and refresh them periodically.
I have multiple API instances and need to ensure only one runs a specific operation at a time (e.g., leaderboard rebuild, scheduled job). I need a distributed mutex without adding a separate locking s...
Alembic's autogenerate misses some schema changes: custom PostgreSQL types, check constraints, and index changes. I need to configure autogenerate to detect more changes and add manual DDL for unsuppo...
I have a many-to-many relationship between traces and tags. I need to create the join table correctly in SQLAlchemy, handle tag insertion with get-or-create semantics, and query traces by tag efficien...
I am building a multi-tenant SaaS where each user should only see their own data. I want PostgreSQL row-level security (RLS) policies to enforce data isolation at the database level.
Need to add full-text search to a PostgreSQL table. Users type natural-language queries like 'python async error handling' and expect relevant rows returned quickly without external search infrastruct...
Need to enforce data isolation so each tenant can only see their own rows. Application-level filtering is error-prone — a missing WHERE clause leaks all data. Want database-enforced isolation.
Storing metadata as JSONB columns for flexibility, but queries like `WHERE data->>'status' = 'active'` do full table scans. Need to index JSONB fields and write efficient queries.
Need to split a single `name` column into `first_name` and `last_name` columns. This requires a schema change (add columns, remove old) AND a data migration (populate new columns from old). Pure DDL m...
Queries filter on multiple columns: `WHERE status = 'validated' AND trust_score > 0.5 ORDER BY created_at DESC`. Single-column indexes on each column aren't used effectively. Query planner does a full...
Query is slow but unsure why. Running EXPLAIN ANALYZE produces verbose output with nodes like 'Seq Scan', 'Hash Join', 'Bitmap Heap Scan' and numbers for cost, rows, and buffers. Need to understand wh...
Inserting thousands of rows one at a time with individual session.add() calls is too slow. Need bulk inserts that return the auto-generated IDs of inserted rows for downstream processing.
Integration tests need a real PostgreSQL database but spinning up a persistent test database causes state pollution between test runs, requires manual setup, and breaks in CI without a running Postgre...
Storing OpenAI embedding vectors in PostgreSQL with pgvector. Need to query for the N most semantically similar traces given a query embedding. Query must filter by tags and status before vector ranki...
Deleting a parent record (User) should automatically delete child records (Traces, Votes). Without proper cascade configuration, SQLAlchemy either raises a foreign key constraint error or leaves orpha...
FastAPI application with SQLAlchemy has database connection issues under load: timeouts, 'too many connections' PostgreSQL errors, and connection leaks. Default connection pool settings are not tuned ...
Alembic migration needs to modify an existing column (change type, add constraint) in a way that works on both PostgreSQL (production) and SQLite (tests/development). PostgreSQL supports ALTER COLUMN ...