generic question: update statistics low drop distr
Posted in 2007
Topics: Installation, Setup & Upgrades
Hi,
why should anyone run
update statistics low drop distributions ?
(maybe except after database upgrades - and even there it is not
possible if the database has serveral terabytes)
What is the disadvantage of running only NEW update statistics commands:
update statistics low ..
update statistics medium ..
update statistics high (for leading index columns)
Regards,
Andreas Kutsche
-------------------------------------------
SPAR Osterreichische Warenhandels-AG
Hauptzentrale
A - 5015 Salzburg, Europastrasse 3
FN 34170 a
Tel: +43 662 4470 24223
Mobile: +43 664 6259575
E-Mail: Andreas.KUTSCHE@spar.at
Internet: http://www.spar.at
Wichtiger Hinweis: Der Inhalt dieser E-Mail kann vertrauliche und rechtlich
geschutzte Informationen, insbesondere Betriebs- oder Geschaftsgeheimnisse,
enthalten, zu deren Geheimhaltung der Empfanger verpflichtet ist. Die
Informationen in dieser E-Mail sind ausschlie?lich fur den Adressaten
bestimmt. Sollten Sie die E-Mail irrtumlich erhalten haben so ersuchen wir
Sie, die Nachricht von Ihrem System zu loschen und sich mit uns in Verbindung
zu setzen.
Uber das Internet versandte E-Mails konnen leicht manipuliert oder unter
fremdem Namen erstellt werden. Daher schlie?en wir die rechtliche
Verbindlichkeit der in dieser Nachricht enthaltenen Informationen aus. Der
Inhalt der E-Mail ist nur rechtsverbindlich, wenn er von uns schriftlich
bestatigt und gezeichnet wird.
Sollte trotz der von uns verwendeten Virus-Schutzprogramme durch die Zusendung
von E-Mails ein Virus in Ihre Systeme gelangen, haften wir nicht fur evtl.
hieraus entstehende Schaden.
Wir danken fur Ihr Verstandnis.
Important notice: The contents of this e-mail may contain confidential and
legally protected information that is in particular related to operational and
trade secrets, which the recipient is obliged to treat as confidential. The
information in this e-mail is made available exclusively for use by the
addressee. In the event that the e-mail may have been sent to you in error, we
would ask you to kindly delete this communication from your system and to
contact us.
E-mails sent via the Internet can be easily manipulated or sent out under
someone else's name. We therefore do not accept legal liability for the
information contained in this communication. The contents of the e-mail are
only legally binding if they have been confirmed and signed by us in writing.
If, in spite of our using Antivirus protection software, a virus may have
penetrated your system through the sending of this e-mail, we do not accept
liability for any damage that may possibly arise as a result of this.
We trust that you appreciate our position.
-------------------------------------------
Andreas.KUTSCHE@spar.at wrote:
> Hi,
>
> why should anyone run
> update statistics low drop distributions ?
> (maybe except after database upgrades - and even there it is not
> possible if the database has serveral terabytes)>
Even on a large database you could run this table by table with far less
runtime required especially if you run several tables in parallel.
That aside, there are few situations requiring one to drop distributions
on a table, besides following a version upgrade. One is if the table is
initially nearly empty and is being loaded and must be queried without
time in between to create new distributions. Another is a load job that
may be adding large numbers of rows to a table which would skew the
actual distribution versus the saved distributions and may need to also
update large numbers of existing rows. Such a job is far more likely to
use a much less than optimal query plan for the updates with
distributions than without. Finally there are some queries and physical
distributions of keys in a table or tables which will always confuse the
optimizer. Other similar scenarios come to mind.
Dropping distributions in these situations will trigger the older OL5
style optimizer code which relies only on the stats counts in systables,
syscolumns, and sysindexes/sysindices to make reasonable decisions about
query plans and is sometimes a better choice. I've sometimes wished we
had an OPTIMIZER HINT to disable the cost based optimizer and revert to
the older one explicitely.
> What is the disadvantage of running only NEW update statistics commands:
> update statistics low ..
> update statistics medium ..
> update statistics high (for leading index columns)>
> Regards,
> Andreas Kutsche
>
Art S. Kagel
Oninit, LLC
<SNIP>
I thought I remember JM saying that US-medium on a table will drop
distributions and rebuild them anyways?
Bob Roussey
Unix / Informix Administration
Spirit Airlines
Robert.Roussey@SpiritAir.com
-----Original Message-----
From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
Art S. Kagel (Oninit LLC)
Sent: Friday, November 30, 2007 9:52 AM
To: ids@iiug.org
Subject: Re: generic question: update statistics low dr.... [10554]
Andreas.KUTSCHE@spar.at wrote:
> Hi,
>
> why should anyone run
> update statistics low drop distributions ?
> (maybe except after database upgrades - and even there it is not
> possible if the database has serveral terabytes)>
Even on a large database you could run this table by table with far less
runtime required especially if you run several tables in parallel.
That aside, there are few situations requiring one to drop distributions
on a table, besides following a version upgrade. One is if the table is
initially nearly empty and is being loaded and must be queried without
time in between to create new distributions. Another is a load job that
may be adding large numbers of rows to a table which would skew the
actual distribution versus the saved distributions and may need to also
update large numbers of existing rows. Such a job is far more likely to
use a much less than optimal query plan for the updates with
distributions than without. Finally there are some queries and physical
distributions of keys in a table or tables which will always confuse the
optimizer. Other similar scenarios come to mind.
Dropping distributions in these situations will trigger the older OL5
style optimizer code which relies only on the stats counts in systables,
syscolumns, and sysindexes/sysindices to make reasonable decisions about
query plans and is sometimes a better choice. I've sometimes wished we
had an OPTIMIZER HINT to disable the cost based optimizer and revert to
the older one explicitely.
> What is the disadvantage of running only NEW update statistics
commands:
> update statistics low ..
> update statistics medium ..
> update statistics high (for leading index columns)>
> Regards,
> Andreas Kutsche
>
Art S. Kagel
Oninit, LLC
<SNIP>
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
Robert Roussey(IT) wrote:
> I thought I remember JM saying that US-medium on a table will drop
> distributions and rebuild them anyways?
>
Well, almost. Medium and HIGH both drop the existing distributions and
insert new ones in a single transaction. If the process is interrupted
the original distributions are still intact. As I said, you really only
have to explicitely DROP DISTRIBUTIONS when upgrading to make sure that
ALL of the old distributions are gone and if you do not want ANY
distributions for an object.
Art S. Kagel
Oninit, LLC
> Bob Roussey
> Unix / Informix Administration
> Spirit Airlines
> Robert.Roussey@SpiritAir.com
>
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> Art S. Kagel (Oninit LLC)
> Sent: Friday, November 30, 2007 9:52 AM
> To: ids@iiug.org
> Subject: Re: generic question: update statistics low dr.... [10554]
>
> Andreas.KUTSCHE@spar.at wrote:
>
>> Hi,
>>
>> why should anyone run
>> update statistics low drop distributions ?
>> (maybe except after database upgrades - and even there it is not
>> possible if the database has serveral terabytes)>>
>>
>
> Even on a large database you could run this table by table with far less
>
> runtime required especially if you run several tables in parallel.
>
> That aside, there are few situations requiring one to drop distributions
>
> on a table, besides following a version upgrade. One is if the table is
> initially nearly empty and is being loaded and must be queried without
> time in between to create new distributions. Another is a load job that
> may be adding large numbers of rows to a table which would skew the
> actual distribution versus the saved distributions and may need to also
> update large numbers of existing rows. Such a job is far more likely to
> use a much less than optimal query plan for the updates with
> distributions than without. Finally there are some queries and physical
> distributions of keys in a table or tables which will always confuse the
>
> optimizer. Other similar scenarios come to mind.
>
> Dropping distributions in these situations will trigger the older OL5
> style optimizer code which relies only on the stats counts in systables,
>
> syscolumns, and sysindexes/sysindices to make reasonable decisions about
>
> query plans and is sometimes a better choice. I've sometimes wished we
> had an OPTIMIZER HINT to disable the cost based optimizer and revert to
> the older one explicitely.
>
>
>> What is the disadvantage of running only NEW update statistics
>>
> commands:
>
>> update statistics low ..
>> update statistics medium ..
>> update statistics high (for leading index columns)>>
>> Regards,
>> Andreas Kutsche
>>
>>
> Art S. Kagel
> Oninit, LLC
> <SNIP>
>
> ************************************************************************
> *******
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>