apache/seatunnel · info
Failed to get approximate row count from table status…
Error message
Failed to get approximate row count from table status, fallback to count rows
What it means
RedshiftDialect.approximateRowCntStatement first tries a fast approximate row count from Redshift's system table (STV_TBL_PERM). On SQLException, or when the query returns no rows, it logs this warning and falls back to an exact COUNT(*) on the table.
Solutions
- No action needed - it falls back to COUNT(*) automatically
- Grant the sync user SELECT on system tables (or elevated perms) to keep the fast path
- Verify the table exists/is visible to the user in Redshift
Example fix
null
Defensive patterns
Strategy: fallback
Try / catch
// behavior is already a fallback; just log-monitor
if (log.contains("fallback to count rows")) { /* consider granting STV_TBL_PERM access */ } Prevention
- Grant the SeaTunnel user access to Redshift system tables for fast row counts
- Ignore this warning unless slow splits on huge tables become a problem
When it happens
Trigger: SELECT from STV_TBL_PERM fails (permission denied, table absent from system view, transient connection error) during split enumeration for JDBC source on Redshift.
Common situations: User lacking access to Redshift system tables; recently created/renamed tables not yet in STV_TBL_PERM; transient cluster connectivity issues.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- Catalog not found, loading tables from jdbc directly. url
- COMMON-17
- COMMON-19
- Failed to check JDBC savepoint support; fallback to full…
- Failed to get clickhouse server config
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/6b20daec872f1134.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/redshift/RedshiftDialect.java:170
.equals(table.getTablePath().getFullName()));
if (useTableStats) {
String rowCountQuery =
String.format(
"SELECT reltuples FROM pg_class r WHERE relkind = 'r' AND relname = '%s';",
table.getTablePath().getTableName());
try (Statement stmt = connection.createStatement()) {
log.info("Split Chunk, approximateRowCntStatement: {}", rowCountQuery);
try (ResultSet rs = stmt.executeQuery(rowCountQuery)) {
if (!rs.next()) {
throw new SQLException(
String.format(
"No result returned after running query [%s]",
rowCountQuery));
}
return rs.getLong(1);
}
} catch (SQLException e) {
log.warn(
"Failed to get approximate row count from table status, fallback to count rows",
e);
return SQLUtils.countForTable(connection, tableIdentifier(table.getTablePath()));
}
}
return SQLUtils.countForSubquery(connection, table.getQuery());
}
}
View on GitHub (pinned to cf67b549a7)