Re: Ignore histograms on sql level

From: Jonathan Lewis <jlewisoracle_at_gmail.com>
Date: Wed, 20 Jan 2021 12:22:47 +0000
Message-ID: <CAGtsp8=-RQw8NuUM-h_=iOpkb4vtc+SgcnPQ4tB5LMJ6N1Mr2Q_at_mail.gmail.com>



As Mladen pointed out, though, there must be something odd happening if it's necessary to disable a histogram just for one query.

The only reason I could think of where this would make sense is if there's a correlation effect that means "if condition A is true then the histogram stats are misleading", which suggests that the table needs a column group added that manages to capture some information about the column with the current histogram and whatever columns make up "condition A".

Regards
Jonathan Lewis

On Wed, 20 Jan 2021 at 12:11, Jonathan Lewis <jlewisoracle_at_gmail.com> wrote:

>
> 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_at_tanelpoder.com> 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
>>
>>
>>
>>

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jan 20 2021 - 13:22:47 CET

Original text of this message