Amazon Redshift · 2026-11-13 · Redshift advanced arc

Amazon Redshift for MCP Servers: Advanced Patterns Playbook — Serverless, Data API Pagination, Spectrum, and COPY

MCP server tools that stop at the basics — a simple ExecuteStatementCommand plus polling — will hit production walls quickly: a Redshift Serverless query hangs for 60 seconds on the first call of the morning, a results loop silently truncates at 100 rows because nobody looped on NextToken, NUMERIC financial figures lose precision when passed through parseFloat, a Spectrum table returns zero rows because a Glue partition was never registered, and a COPY job silently loads only half the CSV because the caller's IAM user doesn't have S3 access (the cluster's attached role does). This guide synthesizes four advanced Redshift patterns — Serverless architecture and cold-start mitigation, Data API pagination with correct type conversion, Spectrum external tables over S3 data lakes, and COPY bulk loading with reliable error handling — into a production playbook that eliminates those failure modes.

TL;DR

Pattern 1: Redshift Serverless — namespaces, RPU config, and cold-start mitigation

Redshift Serverless splits into two resource types with different lifecycles. A namespace owns the storage layer: databases, users, schemas, and automated snapshots. A workgroup owns the compute layer: RPU configuration, VPC placement, security groups, and the DNS endpoint your Data API calls resolve to. The workgroup endpoint looks like <workgroup>.<account>.<region>.redshift-serverless.amazonaws.com:5439; the namespace has no query endpoint of its own.

Both CreateNamespaceCommand and CreateWorkgroupCommand are asynchronous. Poll GetWorkgroupCommand until its status reaches AVAILABLE before attempting any queries — issuing a Data API call against a workgroup that is still CREATING returns a validation error.

import {
  RedshiftServerlessClient,
  CreateNamespaceCommand,
  CreateWorkgroupCommand,
  GetWorkgroupCommand,
  UpdateWorkgroupCommand,
  GetComputeCapacityCommand,
} from "@aws-sdk/client-redshift-serverless";

const rsServerless = new RedshiftServerlessClient({ region: "us-east-1" });

// Create namespace (storage layer)
await rsServerless.send(new CreateNamespaceCommand({
  namespaceName: "analytics-ns",
  adminUsername: "admin",
  adminUserPassword: await getSecret("redshift/admin-password"),
  dbName: "analytics",
  defaultIamRoleArn: "arn:aws:iam::123456789012:role/RedshiftS3ReadRole",
  iamRoles: ["arn:aws:iam::123456789012:role/RedshiftS3ReadRole"],
}));

// Create workgroup (compute layer)
await rsServerless.send(new CreateWorkgroupCommand({
  workgroupName: "analytics-wg",
  namespaceName: "analytics-ns",
  baseCapacity: 8,       // minimum 8, multiples of 8 up to 512
  maxCapacity: 64,       // cost-spike ceiling, introduced 2024
  enhancedVpcRouting: true,
  subnetIds: ["subnet-aaa", "subnet-bbb", "subnet-ccc"],
  securityGroupIds: ["sg-redshift"],
  publiclyAccessible: false,
}));

// Wait until AVAILABLE before querying
async function waitForWorkgroup(name: string): Promise {
  for (let i = 0; i < 30; i++) {
    const { workgroup } = await rsServerless.send(
      new GetWorkgroupCommand({ workgroupName: name })
    );
    if (workgroup?.status === "AVAILABLE") return;
    await new Promise(r => setTimeout(r, 10_000));
  }
  throw new Error("Workgroup did not become AVAILABLE within 5 minutes");
}

Data API differences for Serverless vs provisioned

Three parameters change when you switch from a provisioned cluster to Serverless. The full details are in the Redshift Serverless guide:

Cold-start latency — the critical issue for MCP tools

Redshift Serverless scales to zero compute after approximately 30 minutes of idle time. The first query after that idle window incurs a cold start: 15–60 seconds of initialization before the query begins executing. For an MCP tool responding to a user request, a 60-second stall before the first row returns is unacceptable.

Three mitigations, in order of cost-effectiveness:

  1. EventBridge keep-warm (recommended): schedule a lightweight Lambda that fires SELECT 1 every 5 minutes. The 5-minute interval stays within Redshift Serverless's ~30-minute idle timeout. The Lambda doesn't need to wait for the result — fire-and-forget is fine. Cost impact is negligible: 5-minute keep-warm queries on 8 RPU add roughly $1–2 per month.
  2. Increase base RPU: higher RPU reduces the cold-start duration but does not eliminate it. The idle timeout is fixed; only the restart speed changes.
  3. Switch to provisioned: provisioned clusters have no cold starts. The trade-off is a fixed hourly cost even during zero-query hours.
// Keep-warm Lambda handler (EventBridge schedule: rate(5 minutes))
import { RedshiftDataClient, ExecuteStatementCommand } from "@aws-sdk/client-redshift-data";

const rsData = new RedshiftDataClient({ region: "us-east-1" });

export const handler = async () => {
  // Fire-and-forget — no need to poll
  const { Id } = await rsData.send(new ExecuteStatementCommand({
    WorkgroupName: "analytics-wg",
    Database: "analytics",
    Sql: "SELECT 1",
  }));
  return { statementId: Id };
};

RPU configuration and cost monitoring

Base RPU sets the minimum compute available at all times. Redshift Serverless auto-scales between BaseCapacity and MaxCapacity based on query queue depth. A MaxCapacity ceiling prevents runaway costs from an expensive ad hoc query. Practical starting points: 8 RPU for development workloads, 32–64 RPU for production MCP tools with moderate concurrency.

Update RPU without downtime using UpdateWorkgroupCommand. Pair it with an EventBridge Scheduler rule to drop to 8 RPU after business hours and restore in the morning:

// Scale down at 8 PM — EventBridge Scheduler calls this
await rsServerless.send(new UpdateWorkgroupCommand({
  workgroupName: "analytics-wg",
  baseCapacity: 8,
}));

// Tag queries by tool for per-tool cost attribution in SYS_QUERY_HISTORY
await rsData.send(new ExecuteStatementCommand({
  WorkgroupName: "analytics-wg",
  Database: "analytics",
  Sql: `SET query_group TO 'mcp-tool-sales-report'; ${actualQuery}`,
}));

// Pull weekly RPU consumption
const { capacities } = await rsServerless.send(new GetComputeCapacityCommand({
  workgroupName: "analytics-wg",
  period: "daily",
  startTime: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000),
  endTime: new Date(),
}));
const totalRpuHours = capacities?.reduce((acc, c) => acc + (c.numUnits ?? 0), 0);

One hard constraint on VPC configuration: workgroup subnet IDs and security groups are immutable after creation. To change the VPC layout you must delete and recreate the workgroup. Plan your subnet selection before first deploy, and enable enhancedVpcRouting: true to force COPY and UNLOAD traffic through your VPC rather than the public internet — required for private deployments and mandatory when using VPC-locked S3 Gateway Endpoints.

Pattern 2: Data API pagination — type conversion and result size limits

The Redshift Data API caps each GetStatementResultCommand response at 100 rows. If your MCP tool calls GetStatementResultCommand once and returns the result, every query that produces more than 100 rows is silently truncated — no error, no warning, just a cut-off dataset. The correct pattern is a do…while loop on NextToken:

The full pagination reference with streaming and rate-limit handling is at Redshift Data API pagination guide. The core loop:

import {
  RedshiftDataClient,
  GetStatementResultCommand,
  DescribeStatementCommand,
} from "@aws-sdk/client-redshift-data";
import type { ColumnMetadata, Field } from "@aws-sdk/client-redshift-data";

interface QueryResult {
  columns: ColumnMetadata[];
  rows: Record<string, unknown>[];
  totalRows: number;
}

async function fetchAllPages(statementId: string): Promise<QueryResult> {
  let nextToken: string | undefined;
  let columns: ColumnMetadata[] = [];
  const allRows: Record<string, unknown>[] = [];

  do {
    const response = await rsData.send(new GetStatementResultCommand({
      Id: statementId,
      NextToken: nextToken,
    }));

    // Column metadata is identical on every page — extract once from first page
    if (columns.length === 0 && response.columnMetadata) {
      columns = response.columnMetadata;
    }

    for (const row of response.records ?? []) {
      allRows.push(rowToObject(row, columns));
    }

    nextToken = response.NextToken;
    if (nextToken) await new Promise(r => setTimeout(r, 100)); // 10 req/sec rate limit
  } while (nextToken);

  return { columns, rows: allRows, totalRows: allRows.length };
}

The Field type discriminated union — every Redshift type mapped

Each cell in a Redshift Data API response is a Field object with exactly one key populated. The key tells you the value type. The critical rule: check isNull first — it appears on any nullable column with a NULL value, and if you check other keys first on a null row you get undefined, not null.

function fieldToValue(field: Field, col: ColumnMetadata): unknown {
  // NULL check MUST come first — present on any nullable column with NULL
  if (field.isNull === true) return null;

  if (field.stringValue !== undefined) {
    const t = col.typeName?.toUpperCase() ?? "";
    if (t === "DATE") return new Date(field.stringValue);
    if (t === "TIMESTAMP" || t === "TIMESTAMPTZ") return new Date(field.stringValue);
    // NUMERIC and DECIMAL always arrive as strings — intentional for precision preservation
    // Never parseFloat() a NUMERIC column; use a decimal library for arithmetic
    return field.stringValue;
  }

  if (field.longValue !== undefined) {
    const t = col.typeName?.toUpperCase() ?? "";
    // BIGINT values can exceed Number.MAX_SAFE_INTEGER — use BigInt for large IDs
    if ((t === "INT8" || t === "BIGINT") &&
        Math.abs(field.longValue) > Number.MAX_SAFE_INTEGER) {
      return BigInt(field.longValue);
    }
    return field.longValue;
  }

  if (field.doubleValue  !== undefined) return field.doubleValue;   // FLOAT / DOUBLE
  if (field.booleanValue !== undefined) return field.booleanValue;  // BOOLEAN
  if (field.blobValue    !== undefined) return field.blobValue;     // VARBYTE

  return null;
}

The full type mapping matters for MCP financial tools: NUMERIC(12,4) columns that hold revenue figures arrive as stringValue. Passing them through parseFloat loses decimal precision at the 15th significant digit — a rounding error invisible in development but material at $1,000,000.0001 precision. Keep them as strings and use a decimal arithmetic library (decimal.js, big.js) if the tool needs to aggregate them.

Result size limits and query design

The Data API caches results for 24 hours after statement completion. The cache limit is 100 MB total — when a query exceeds this, the Data API returns a FAILED status (not a truncated result), and DescribeStatementCommand will show the error. The fix is always an explicit LIMIT clause in every MCP-facing query:

// Guard against accidental full-table scans from MCP tool input
const { TotalNumRows } = await rsData.send(
  new DescribeStatementCommand({ Id: statementId })
);
if ((TotalNumRows ?? 0) > 10_000) {
  throw new McpError(
    ErrorCode.InvalidRequest,
    `Query returned ${TotalNumRows} rows. Add a more specific filter or use LIMIT.`
  );
}

LLM-friendly result formatting

LLMs consume tabular data better with column type annotations. Format results as a markdown table with the type name next to each column header, cap at 50 rows for the LLM context, and append a truncation note when rows were omitted:

function formatResultForLlm(result: QueryResult): string {
  const { columns, rows, totalRows } = result;
  const header = columns.map(c => `${c.name} (${c.typeName})`).join(" | ");
  const sep    = columns.map(() => "---").join(" | ");
  const data   = rows.slice(0, 50).map(row =>
    columns.map(c => {
      const v = row[c.name!];
      if (v === null) return "NULL";
      if (v instanceof Date) return v.toISOString().slice(0, 10);
      return String(v);
    }).join(" | ")
  );
  const note = totalRows > 50
    ? `\n\n*Showing first 50 of ${totalRows} rows.*`
    : "";
  return `| ${header} |\n| ${sep} |\n${data.map(r => `| ${r} |`).join("\n")}${note}`;
}

Pattern 3: Redshift Spectrum — querying S3 data lakes without loading

Redshift Spectrum lets you query files stored in S3 directly from SQL — no COPY, no ETL, no Redshift storage cost. The query optimizer pushes predicate filters to the S3 tier (Parquet-only); only the blocks needed to satisfy the query are transferred. Cost is $5 per terabyte of S3 data scanned, with a 10 MB minimum per query.

The architecture has three layers: a Spectrum IAM role attached to your cluster or namespace, a Glue Data Catalog database that holds external table definitions, and an external schema in Redshift that maps to that Glue database. Once the schema is created, every table in the Glue database is immediately visible in Redshift with no additional registration. Full setup details are in the Redshift Spectrum guide.

IAM role — attached to the cluster, not the caller

Spectrum authentication works identically to COPY: the IAM role is attached to the cluster or namespace, and the Data API caller only needs redshift-data:* permissions. The Spectrum role requires redshift.amazonaws.com as its trust principal and minimum permissions of s3:GetObject, s3:ListBucket, and glue:GetDatabase, glue:GetTable, glue:GetPartitions:

-- External schema creation (single DDL statement)
CREATE EXTERNAL SCHEMA spectrum
FROM DATA CATALOG
DATABASE 'analytics_lake'
IAM_ROLE 'arn:aws:iam::123456789012:role/RedshiftSpectrumRole'
REGION 'us-east-1'
CREATE EXTERNAL DATABASE IF NOT EXISTS;

-- External table with partition projection (recommended over manual partition management)
CREATE EXTERNAL TABLE spectrum.events (
  event_id    VARCHAR(36),
  user_id     VARCHAR(36),
  event_type  VARCHAR(64),
  revenue_usd DECIMAL(12, 4),
  event_at    TIMESTAMP
)
PARTITIONED BY (dt VARCHAR(10))
STORED AS PARQUET
LOCATION 's3://my-data-lake-bucket/events/'
TABLE PROPERTIES (
  'projection.enabled'           = 'true',
  'projection.dt.type'           = 'date',
  'projection.dt.format'         = 'yyyy-MM-dd',
  'projection.dt.range'          = '2024-01-01,NOW',
  'projection.dt.interval'       = '1',
  'projection.dt.interval.unit'  = 'DAYS',
  'storage.location.template'    = 's3://my-data-lake-bucket/events/dt=${dt}/'
);

Partition projection — eliminate manual registration

Without partition projection, every new day's partition must be registered manually with ALTER TABLE spectrum.events ADD PARTITION (dt = '2026-11-13') LOCATION 's3://…/dt=2026-11-13/'. Miss a registration and queries against that date return zero rows with no error. At scale, the Glue Data Catalog imposes a hard limit of 1 million partitions per table — a time-series table partitioned by day hits that in under three years.

Partition projection solves both problems. Redshift computes which partitions exist based on the range specification you declare in the table properties, never consulting the Glue catalog for partition lookup. New S3 prefixes matching the template are automatically visible. Queries against dates with no S3 data return zero rows rather than an error.

Lake Formation column-level security

When Lake Formation governs your Glue catalog, Spectrum queries pass through Lake Formation permission checks at execution time. Column-level restrictions — for example, excluding pii_email and pii_phone columns — are enforced server-side. A query referencing an excluded column fails; the column is not silently nulled. Grant explicit column access with GrantPermissionsCommand:

import { LakeFormationClient, GrantPermissionsCommand } from "@aws-sdk/client-lakeformation";

await lf.send(new GrantPermissionsCommand({
  Principal: { DataLakePrincipalIdentifier:
    "arn:aws:iam::123456789012:role/RedshiftSpectrumRole" },
  Resource: {
    TableWithColumns: {
      CatalogId: "123456789012",
      DatabaseName: "analytics_lake",
      Name: "events",
      ColumnWildcard: {
        ExcludedColumnNames: ["pii_email", "pii_phone"],
      },
    },
  },
  Permissions: ["SELECT"],
}));

Performance and cost optimization

File format selection is the single biggest lever on Spectrum query cost. Parquet with Snappy compression enables both column pruning (only the requested columns are read off disk) and row-group-level predicate pushdown (only row groups matching your WHERE clause are transferred from S3). JSON format has neither capability — a SELECT event_type FROM events WHERE dt = '2026-11-13' on a JSON table reads every column in the entire day's data. Use Parquet. At equivalent data volume, a typical analytical query on Parquet scans 1–5% of the bytes a JSON equivalent would.

Monitor per-query scan cost through the SVL_S3QUERY_SUMMARY system view — the qualified_partitions vs total_partitions ratio tells you how effectively your partition filter is working, and s3_scanned_bytes gives the exact cost figure for each query:

SELECT query, total_partitions, qualified_partitions,
       s3_scanned_bytes, s3_scanned_rows
FROM SVL_S3QUERY_SUMMARY
ORDER BY starttime DESC
LIMIT 20;

Hard limits to design around: Spectrum is read-only (no INSERT, UPDATE, DELETE, or transactions on external tables), cross-region queries are not supported (S3 bucket must be in the same region as the cluster), and Redshift Serverless has a narrower set of supported Spectrum features than provisioned clusters — test Serverless against your specific query patterns before committing to it for Spectrum-heavy workloads.

Pattern 4: COPY command — bulk loading from S3 with reliable error handling

COPY is the right tool for loading large datasets into Redshift: it parallelizes across all compute nodes, pushes format parsing to the S3 tier for Parquet, and runs 10–100× faster than row-by-row INSERT statements executed through the Data API. The full reference is in the Redshift COPY command guide; this section covers the three non-obvious production requirements.

The IAM role gotcha — it's on the cluster, not the caller

The single most common COPY misconfiguration: you give the Lambda's execution role s3:GetObject access to the ingest bucket, run a COPY, and get an S3 access error. The Lambda's S3 permission is irrelevant. COPY uses an IAM role attached to the cluster or namespace — the cluster assumes that role to read S3, and the role must trust redshift.amazonaws.com as its service principal.

Your Lambda only needs Data API permissions (redshift-data:ExecuteStatement, redshift-data:DescribeStatement, redshift-data:GetStatementResult). The S3 access path is entirely: Lambda → Data API → Redshift cluster → assumes attached role → S3.

async function runCopy(params: {
  table: string;
  s3ManifestPath: string;
  iamRoleArn: string;
  workgroupName: string;
  database: string;
}) {
  const copySql = `
    COPY ${params.table}
    FROM '${params.s3ManifestPath}'
    IAM_ROLE '${params.iamRoleArn}'
    FORMAT AS PARQUET
    MANIFEST
    MAXERROR 100
    STATUPDATE OFF
    COMPUPDATE OFF
    REGION 'us-east-1'
  `;

  const { Id: statementId } = await rsData.send(new ExecuteStatementCommand({
    WorkgroupName: params.workgroupName,
    Database: params.database,
    Sql: copySql,
  }));

  // Poll until terminal state — COPY can take minutes for large loads
  for (let i = 0; i < 180; i++) {
    const { Status, Error: err } = await rsData.send(
      new DescribeStatementCommand({ Id: statementId! })
    );
    if (Status === "FINISHED") return statementId!;
    if (Status === "FAILED")   throw new Error(`COPY failed: ${err}`);
    if (Status === "ABORTED")  throw new Error("COPY aborted");
    await new Promise(r => setTimeout(r, 5_000));
  }
  throw new Error("COPY timed out after 15 minutes");
}

Manifest files — preventing double-loads on retry

Without a manifest, COPY loads every S3 object under the given prefix. If the same COPY runs twice (a Lambda retry, an at-least-once pipeline), every row in the prefix gets loaded twice. If new files arrive at the prefix between attempts, they get loaded unexpectedly. Manifest files specify exactly which files to load, with mandatory: true causing the job to fail if a named file is missing:

async function createManifest(
  s3: S3Client,
  bucket: string,
  manifestKey: string,
  fileKeys: string[]
): Promise<string> {
  const manifest = {
    entries: fileKeys.map(key => ({
      url: `s3://${bucket}/${key}`,
      mandatory: true,     // fail COPY if file is absent
    })),
  };
  await s3.send(new PutObjectCommand({
    Bucket: bucket,
    Key: manifestKey,
    Body: JSON.stringify(manifest),
    ContentType: "application/json",
  }));
  return `s3://${bucket}/${manifestKey}`;
}

Format-specific COPY options

Parquet is the simplest format: FORMAT AS PARQUET and no other format options. Column names in the Parquet file match Redshift column names case-insensitively; schema is auto-detected.

CSV has several defaults that cause silent data corruption if you rely on them:

JSON expects newline-delimited JSON (NDJSON) — one object per line, not a JSON array. Use JSON 'auto ignorecase' to match keys to columns case-insensitively. If your upstream produces JSON arrays, transform them to NDJSON via a Kinesis Firehose Lambda transform before they reach S3; Redshift COPY has no built-in array flattening.

Always check STL_LOAD_ERRORS — even on FINISHED status

When MAXERROR N is set, COPY can load a partial dataset — some rows succeed, up to N rows fail and are skipped — and still report FINISHED. Without checking STL_LOAD_ERRORS you won't know. Query the view after every COPY run:

const errorQueryId = await executeAndWait({
  WorkgroupName: "analytics-wg",
  Database: "analytics",
  Sql: `
    SELECT starttime, filename, line_number, colname, type,
           raw_field_value, err_code, err_reason
    FROM STL_LOAD_ERRORS
    WHERE starttime >= DATEADD(minutes, -5, GETDATE())
    ORDER BY starttime DESC
    LIMIT 100
  `,
});
const { rows: errors } = await fetchAllPages(errorQueryId);
if (errors.length > 0) {
  console.warn(`COPY completed with ${errors.length} row errors:`, errors);
}

The NOLOAD option performs a dry run: it validates all rows against the target schema and format options, writes errors to STL_LOAD_ERRORS, but loads nothing. Use it on the first production run of a new data pipeline to surface type mismatches and format errors before writing a single row.

UNLOAD — the reverse operation for large exports

The Data API's 100 MB result cache limit makes it impractical for exporting large datasets. UNLOAD writes query results directly to S3 in Parquet or CSV, parallelizing across compute nodes. The output is always a set of files with an accompanying manifest — that manifest can be fed directly to a subsequent COPY:

UNLOAD ('SELECT * FROM sales WHERE sale_date >= ''2026-11-01''')
TO 's3://export-bucket/sales-weekly/'
IAM_ROLE 'arn:aws:iam::123456789012:role/RedshiftCopyRole'
FORMAT AS PARQUET
PARALLEL ON
MAXFILESIZE 256 MB
ALLOWOVERWRITE;

Putting it together — a Redshift-backed MCP analytics tool

A production MCP analytics server that integrates all four patterns looks like this at a high level:

  1. Infrastructure: Redshift Serverless namespace + workgroup with an attached IAM role that has S3 and Glue permissions (used by both Spectrum queries and COPY jobs). EventBridge keep-warm Lambda fires every 5 minutes. BaseCapacity 8 RPU, MaxCapacity 64 RPU.
  2. Read tools (query_analytics, get_sales_summary, etc.): issue ExecuteStatementCommand with WorkgroupName, poll until FINISHED, loop on NextToken for all pages, convert fields with the type discriminated union (preserve NUMERIC as strings), format for LLM with the 50-row cap, guard against >10,000-row results.
  3. Data lake read tools (query_events_lake, get_archive_metrics): query Spectrum external tables — partition projection keeps them current without maintenance; SVL_S3QUERY_SUMMARY monitors scan cost per tool call.
  4. Write tools (bulk_load_records, ingest_batch): generate a manifest file, run COPY with MANIFEST + MAXERROR 100 + NOLOAD dry-run on first call, poll until FINISHED, always read STL_LOAD_ERRORS and return error count to the caller.
  5. Large export tools (export_to_s3): run UNLOAD to S3, return the manifest key; a downstream system picks up the manifest and processes the Parquet files.

The MCP server endpoint monitoring this stack runs on AliveMCP's uptime monitoring — a 60-second ping that catches cold-start regressions, IAM permission drift, and schema-change errors before the next user sees them. All four patterns above depend on the cluster being healthy; a silent misconfiguration in a Spectrum IAM role or a COPY job that starts failing overnight goes unnoticed until an agent reports garbage data at 9 AM.

Quick-reference: errors and their causes

Error Cause Fix
AccessDeniedException on ExecuteStatement Missing redshift-serverless:GetCredentials in caller's IAM policy Add the action; the error message does not name it explicitly
Query stuck in STARTED for 60 seconds Serverless cold start after idle period Add EventBridge keep-warm Lambda (5-minute interval)
ValidationException: cannot specify both ClusterIdentifier and WorkgroupName Wrong Data API call pattern for Serverless Remove ClusterIdentifier; use WorkgroupName only
Results silently truncated at 100 rows Missing NextToken loop in pagination Use a do…while (nextToken) loop
NUMERIC columns losing decimal precision Calling parseFloat(field.stringValue) Keep as string; use decimal.js for arithmetic
FAILED status with "result exceeded 100 MB" Query returns too many rows for Data API cache Add LIMIT clause; use UNLOAD for bulk exports
Spectrum table returns zero rows for recent partitions Missing ALTER TABLE ADD PARTITION Enable partition projection to auto-discover new S3 prefixes
COPY S3 access error despite Lambda having S3 permissions COPY uses cluster-attached role, not caller's credentials Attach a role with redshift.amazonaws.com trust to the cluster
COPY loads duplicate rows on retry Prefix-based COPY without manifest Use a manifest file with mandatory: true per entry
COPY reports FINISHED but rows are missing MAXERROR N silently skipped bad rows Always query STL_LOAD_ERRORS after every COPY