SQL Performance (MOSC)

MOSC Banner

Wrong cardinality for a GTT whose stats have juste been gathered

edited Aug 5, 2025 1:31PM in SQL Performance (MOSC) 10 commentsAnswered

Hello,

my DB version is 19.13.

I'm trying to understand why Oracle isn't showing the correct cardinality for a GTT used in a query of a bulk collect operation. The GTT's gets populated and its stats gathered just before the bulk collect. I used 100% as the estimate_percent for the stats gathering. The table has 18 rows, but Oracle shows 8168 in the "Rows" section of the explain plan.

The settings is session-private statistics for global temporary tables.

SELECT DBMS_STATS.get_prefs('GLOBAL_TEMP_TABLE_STATS') FROM dual;
—> SESSION

SELECT table_name, num_rows, scope
FROM dba_tab_statistics
WHERE owner = 'K_MUT_PP'

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center