Document Type | Troubleshooting
Category | Patch/Upgrade
Applicable Product Version | 6FS07
Document Number | TPATS023
Issue
A 15111 error occurs when an attempt is made to access an index outside the range of an array or collection.
This error is especially likely to occur within PL/SQL, Tibero PSM, procedures/functions.
Example) The array size is 10, but an attempt is made to access the 11th element.
NoteTHROW. ec=ERROR_PSM_SUBSCRIPT_OUTSIDE_LIMIT(-15111) [ Subscript is out of range. ]
Cause
When existing collected statistics are present, an error occurs during statistics collection due to a discrepancy, causing the bucket count to be mistaken for the Number of Distinct values (NDV), which means how many unique values exist in a specific column.
CautionIf the NDV and bucket count do not match, the database may misinterpret the data distribution. This can lead to inefficient query execution plans and affect DBMS performance.
When NDV is greater than the actual bucket count
The data distribution is underestimated, potentially resulting in unnecessarily inefficient query execution plans.
When NDV is less than the actual bucket count
The data distribution is overestimated, causing the optimizer to inaccurately estimate query costs.
NoteYou can check whether NDV and bucket count differ by querying histograms as shown below.select HH.hist_head_id, HH.ndv, H.cnt, H.mx from (select dhh.hist_head_id, dhh.distinct_cnt ndv from sys._dd_hist_head dhh) HH, (select count(dh.bucket) cnt, max(dh.bucket) mx, dh.hist_head_id from sys._dd_histogram dh group by dh.hist_head_id) H where HH.hist_head_id = H.hist_head_id and HH.ndv != H.cnt and H.mx > 256;If the query result is not 0 rows (meaning bucket count and NDV do not match), it is abnormal.At this time, histograms play an important role in accurately modeling data distribution and helping the database establish efficient query execution plans.
Solutions
Apply a patch to resolve the issue where bucket count is mistaken for NDV due to errors during statistics collection. (Applied patch: FS07_CS_210768a)
- If the collected bucket_cnt exceeds 256, it is always collected as frequency, so even if there is a discrepancy between previously collected NDV and bucket_cnt, the existing NDV will be trusted and used for collection.
CautionApply the patch through technical support provided by Tmax Tibero.