Re: Ignore histograms on sql level

  • From: Jonathan Lewis <jlewisoracle@xxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 20 Jan 2021 12:11:39 +0000

That seems to be the case.

It's not necessarily to supply all the values, so the "safest" option, or
"most logical" option would simply be to disable the histogram and bring
the arithmetic back to using the recorded/known number of distinct values
with:

/*+ column_stats({owner}.{table} {column_name} set distinct=nn) */

{owner}. is optional
{table} is the actual table name (not the alias).
"set" or "scale" seem to do the same thing
The commas shown by Sayan are optional
The order of the stats (if you want more than just distinct=) is variable


Regards
Jonathan Lewis


On Wed, 20 Jan 2021 at 02:33, Tanel Poder <tanel@xxxxxxxxxxxxxx> wrote:

Cool,

So with COLUMN_STATS you could use a SQL Patch to precisely disable
histogram use for just one column of a single table in a single query.

--
Tanel Poder
https://tanelpoder.com/events




Other related posts: