473,683 Members | 3,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forcing auto-update statistics to fire in SQL Server 2000

Our users have potentially dirty legacy data that they need to get
into our application. We provide a set of staging tables, which map
to our source tables, that the users do their ETL into. Every row in
the source tables has a generated integer id. Every row in both the
source and staging tables has a unique publicid (varchar(22)). All
foreign key references in the staging tables are through publicids.
(The foreign key reference could be to a row in a source or staging
table.)

After successfully validating the data in the staging tables, we then
walk the tables in a safe ordering (no forward references on foreign
keys) and do insert/selects from the staging tables into the source
tables. We generate correlated subqueries in the select list to do
the publicid->id mappings for the foreign keys. For example:

insert into t1(id, fooid) select id, (select id from foo where
t1.publicid = foo.publicid) from t1;

All insert/selects are done in a single transaction as we need to
perform some additional validations afterwards before deciding that it
is okay to commit the changes.

The problem is that the optimizer is choosing bad query plans for the
insert/selects where there are foreign key references to be
translated. In our test case, the primary key table is growing from 0
to 750,000 rows, but the optimizer is choosing a table scan. (NOTE:
Optimizer chooses same query plan when we rewrite the query to be a
left outer join instead of using a correlated subquery in the select
list.)

The change counts that cause auto-update statistics to be fired do not
get modified during an insert/select. I tried do a searched update,
followed by a select, after the insert/select in an attempt to cause
auto-update statistics to get triggered, but it didn't work:

UPDATE foo SET publicid = publicid;
SELECT MIN('asdf' + publicid) FROM foo;

Microsoft support suggested calling DBCC UPDATEUSAGE(). This worked
on one machine, but did not work on another machine with the exact
same HW, patch level and configuration.

(NOTE: We can't call UPDATE STATISTICS because that can't be done
within a transaction.)

Any clues how to force auto-update statistics to be fired?
Jul 20 '05 #1
0 3728

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2713
by: John | last post by:
Hi All, is there any way to force the encoding type used by the browser. In my application special characters need to be displayed and for some reason if the 'auto-select' is left on in the view->encoding menu then these are not displayed correctly. For some reason my page also flickers when this option is left on but i have no idea why this is happening. I have tried using <meta http-equiv="Content-Type" content="text/html;
2
3417
by: petev | last post by:
Hello, can anyone help me out?? Maybe its a bit complicated, maybe not :) I'll try to explain. Am not a programmer so have patience! I have a website whose url looks like this: http://home.provider.nl/~mybusiness/ Shortly I have a registered a domain name: http://www.mybusiness.nl
15
4824
by: Andrew Fedoniouk | last post by:
I have a simple test document which produce the following in Mozilla and Opera: http://terrainformatica.com/w3/p2/problem1.png Internet Explorer behaves as per recommendation (I guess) Did I miss something and width of paragraph can be set less than its content (without overflow specification)? Document is here: http://terrainformatica.com/w3/p2/problem1.htm
1
13955
by: Glabbeek | last post by:
I'm changing the layout of my site. Instead of using tables, I will use DIVs. It's working fine, except for 1 thing: In IE6 some DIVs are not the correct width. Mozilla and Opera are showing the page the way I want. Does anybody know a solution for this? First of all, the code I am using: CSS ------- body {
2
7463
by: janet | last post by:
HI, I had a question on auto-commit in DB2 EEE V8 on AIX V5. Here is my example.. there are two script A.sh , B.SQL A.sh is following:
0
1322
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(thisStream, obj);
1
4368
by: camphor | last post by:
hi all, I have a webpage with just images and am using a liquid layout for my css, go to http://www.christinebec.com/About CB/selected_editorials.htm to see what I am talking about, after the last image (vogue shops) on the page, I want to force a new line so I can add a new heading "catalogues" and then put more images under this heading. This is my attempt: <br class="clearboth"> <div id="contents"> <h2>CATALOGUES</h2></div> <div...
4
3662
by: ATS16805 | last post by:
Hi. I wonder if it's possible to "force" a browser to "switch to SSR mode" for any given document. Specifically, I'm looking for a solution, not to a User Agent issue (i think), but a coding idea; a programming "what if..?". i'm not concerned w/ manipulating a browser (i.e. prefs., settings this URL, always view SSR, save), but rather something i would code into the document which would request the browser to display in this mode (i.e....
1
5782
by: JesenkoS | last post by:
I have absolutely positioned, fixed size div (mainDiv) on a page, inside which a header(headerDiv) , a div containing data (dataDiv) and a footer(footerDiv) should be displayed. Scrollbars should be shown if there is too much data to fit inside containing div. The problem is that headerDiv has variable height, so dataDiv can't have fixed height defined, but should take all available height that remains in mainDiv <style> #mainDiv{...
4
1964
by: mike1reynolds | last post by:
I have a VirtualMode DataGridView that bogs down on using the mouse wheel to scroll and gets a backlog of messages such that it continues to scroll long after ceasing to turn the mouse wheel. This is because instead of generating one scrollbar message for each mouse wheel message it generates a separate scrollbar message for each line move, forcing the entire screen to refresh with each line added. I've put in code to scroll multiple lines...
0
8504
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9042
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8922
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6429
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4519
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2195
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.