You are here: Planning multiple queries « MsSQL Server « IT news, forums, messages
Planning multiple queries

Posted by jim_geissman on 11/23/86 11:33

I'm cleaning data which involves updating ~12 million rows with three
different models, progressively. First clean values using the model
with finest granularity, then the remainder with the next model,
finally what's left using the last model. The first model sets ~1/2 of
the rows, the second ~1/4, the third ~1/5, and the remaining 5% don't
get updated.

It's something like this:

UPDATE t SET value=value*m.AdjustmentFactor, updateFlag='updated'
FROM Table t JOIN Models m ON ....
WHERE m.ModelID='first model' AND t.updateFlag IS NULL

Start with 'first model' then 'second model' etc.

I'm wondering what happens if I submit all three queries together, or
as three separate submissions, waiting for the one before to complete.
If I do them all as one group, the query planner might plan for the
second and third updates based on the initial distribution of values.
However, the first update removes half of the rows from consideration,
so it seems to me a new plan should be prepared for the second query,
based on the distribution at that time. If I highlight the queries in
Query Analyzer and execute, are all three plans created at the
beginning? Does putting GO between them (which I do) make any
difference?

This is SQL Server 2000.

Thanks,
Jim

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация