Update Stats
Posted in 2000
Topics: General Discussion
I am a little confused but some of you might be able to clear this up for me. I have a table with only 2 columns and I was loading only 2000 rows from a temp table. It was loading 5 rows per second and then I ran update stats high on the table and it completed the load within seconds. Could someone tell me how does update stats help on a insert? Thanks in advance. Sent via Deja.com http://www.deja.com/ Before you buy.
bullmkt123@my-deja.com wrote in message <90jal8$ehi$1@nnrp1.deja.com>... >I am a little confused but some of you might be able to clear this up >for me. I have a table with only 2 columns and I was loading only 2000 >rows from a temp table. It was loading 5 rows per second and then I ran >update stats high on the table and it completed the load within >seconds. Could someone tell me how does update stats help on a insert? This does indeed sound wierd. However, you haven't mentioned the tables relationships to other tables. Actually, you haven't mentioned how you are performing the inserts either. Facts about the temp table (such as indexes) and facts about the target table such as indexes, foreign key relations to other tables (from either direction) and any triggers attached to the table are all relevant. Please also describe or supply a short sample of the code you are actually using to insert the rows.
bullmkt123@my-deja.com wrote: > I am a little confused but some of you might be able to clear this up > for me. I have a table with only 2 columns and I was loading only 2000 > rows from a temp table. It was loading 5 rows per second and then I ran > update stats high on the table and it completed the load within > seconds. Could someone tell me how does update stats help on a insert? > > > Thanks in advance. > > > Sent via Deja.com http://www.deja.com/ > Before you buy. The table you were inserting to, was it empty before or did it already contain rows? If it was not empty, then probably this would be the explication: update statistics stores some information about the index key distribution which helps the insert to find the location where to insert faster instead of having to scan the table (or at least parts of it) sequentially. set explain on could give you a hint. regards -- Helmut Leininger Bull AG / Vienna Open Systems Support Email: h.leininger@bull.at helmut.leininger@bull.net This opinion is mine and not necessarily that of my employer. No guarantees whatsoever.