473,598 Members | 3,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very serious bug with Materialized/Indexed views and SQL server

Do not trust values returned by materialized views under SQL Server
without frequently checking underlying tables!!!

I already posted this message under microsoft.publi c.sqlserver.ser ver
and I'm amazed nobody from Microsoft answered about this problem. By
inserting lots of data into our two main tables for about 30 minutes,
we can fail our materialized view that performs a count_big on those
two tables.

Executing (after of course having stopped inserting rows in our two
tables)
SELECT SUM(field1+fiel d2+field3) FROM MatView option(expand views)
DOES NOT RETURN the same value than:
SELECT SUM(field1+fiel d2+field3) FROM MatView with (noexpand)


The second call - using the materialized view - returns a smaller
number (as if counts were lost during our bulk insert)

As our data has to be accurate, we cannot use Materialized views
anymore. This problem does not occur when the amount of data inserted
is smaller. Rebuilding the clustered index on the view fixes the
problem; do we have to constantly be rebuilding the index to keep the
view synchronize !?!!?!

Is there a way to tell that our view is not synchronized? Just
comparing values returned by our view does not work for us as data is
constantly been inserted.

System: SQL server 2000 SP3 Enterprise Edition

Vincent LIDOU
Jul 20 '05 #1
6 4219

"Vincent LIDOU" <vl****@laposte .net> wrote in message
news:f6******** *************** ***@posting.goo gle.com...
Do not trust values returned by materialized views under SQL Server
without frequently checking underlying tables!!!

I already posted this message under microsoft.publi c.sqlserver.ser ver
and I'm amazed nobody from Microsoft answered about this problem. By
inserting lots of data into our two main tables for about 30 minutes,
we can fail our materialized view that performs a count_big on those
two tables.

Executing (after of course having stopped inserting rows in our two
tables)
SELECT SUM(field1+fiel d2+field3) FROM MatView option(expand views)


DOES NOT RETURN the same value than:
SELECT SUM(field1+fiel d2+field3) FROM MatView with (noexpand)


The second call - using the materialized view - returns a smaller
number (as if counts were lost during our bulk insert)

As our data has to be accurate, we cannot use Materialized views
anymore. This problem does not occur when the amount of data inserted
is smaller. Rebuilding the clustered index on the view fixes the
problem; do we have to constantly be rebuilding the index to keep the
view synchronize !?!!?!

Is there a way to tell that our view is not synchronized? Just
comparing values returned by our view does not work for us as data is
constantly been inserted.

System: SQL server 2000 SP3 Enterprise Edition

Vincent LIDOU


I've also used indexed views, and I've never seen this issue, but we don't
really use them the same way - we rarely update data in the underlying
tables. In any case, if you can reproduce this, then the best thing to do is
to open a support case with Microsoft - support calls due to bugs in the
product are free.

Simon
Jul 20 '05 #2
[posted and mailed, répondre en news s'il vous plaît]

Vincent LIDOU (vl****@laposte .net) writes:
Do not trust values returned by materialized views under SQL Server
without frequently checking underlying tables!!!

I already posted this message under microsoft.publi c.sqlserver.ser ver
and I'm amazed nobody from Microsoft answered about this problem.


I am not. While Microsoft hosts the newsgroups, they are intended to
be peer-to-peer communites. There is one exception: if you are a
MSDN or Technet Managed Customer, you should expect an answer if
you:

1) Post to a group which is listed by MSDN or Technet as registred. (And
of course, if you are a managed MSDN customer, posting to a group
managed by Technet will not help you).
2) You post with the address you have registered with Technet or
MSDN. Since you posted your original post from the web interface
with the default address an*******@discu ssions.microsof t.com you
was not able to get a Technet answer anyhow.

And actually, I believe that not even in this case you may get a
Microsoft answer, if someone gives a satisfactory answer before
Microsoft comes around to it.

Now, all that said, MS staff often answers questions in the newsgroups
anyway, both in microsoft.* as well as in this newsgroup. But that
still does not mean you will get an answer. And your original post was not
one that was easily answered. And this post in comp.databases. ms-sqlserver
was even worse.

Why? Because there is no way for the person who reads the post to
reproduce the problem. Basically, all that can be said is: First
verify that you are running at least SP3 of SQL Server. If you do,
then open a case with Microsoft. If there is a bug, then you will
have your initial expenses refunded.

Now, if you would like me to pursue the issue through the newsgroups,
the normal procedure would be that I asked you for the CREATE TABLE
CREATE VIEW and CREATE INDEX statements for the view as well and
underlying tables. (I see that you included the view in your original
post, but it's nice to have all in one place). I would then need then data,
and instructions how to reproduce the problem with that data.

But given the volumes, you cannot post it on the newsgroup. Possibly
you could post it on a web site. However, it might be that this only
happens if you have some certain degree of parallelism, certain
hardware etc. And this is why I think a PSS case might be more effecient.
Note: I did not see the original post at the time it was posted, but
I did look it up for this posting.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3
Vincent,

Please open a support case with SQL Server support, and they can help you to diagnose/work around/get a fix for this problem.

Thanks,
Ryan Stonecipher
SQL Server Storage Engine.
"Vincent LIDOU" <vl****@laposte .net> wrote in message news:f6******** *************** ***@posting.goo gle.com...
Do not trust values returned by materialized views under SQL Server
without frequently checking underlying tables!!!

I already posted this message under microsoft.publi c.sqlserver.ser ver
and I'm amazed nobody from Microsoft answered about this problem. By
inserting lots of data into our two main tables for about 30 minutes,
we can fail our materialized view that performs a count_big on those
two tables.

Executing (after of course having stopped inserting rows in our two
tables)
SELECT SUM(field1+fiel d2+field3) FROM MatView option(expand views)
DOES NOT RETURN the same value than:
SELECT SUM(field1+fiel d2+field3) FROM MatView with (noexpand)


The second call - using the materialized view - returns a smaller
number (as if counts were lost during our bulk insert)

As our data has to be accurate, we cannot use Materialized views
anymore. This problem does not occur when the amount of data inserted
is smaller. Rebuilding the clustered index on the view fixes the
problem; do we have to constantly be rebuilding the index to keep the
view synchronize !?!!?!

Is there a way to tell that our view is not synchronized? Just
comparing values returned by our view does not work for us as data is
constantly been inserted.

System: SQL server 2000 SP3 Enterprise Edition

Vincent LIDOU
Jul 20 '05 #4
Thanks for your answers.

My problem is the following: even if Microsoft can provide us with a
fix, I wouldn't be allowed to install it on our porduction servers (we
can only install service packs). Also, I wish I could spend more time
tracking down this bug with Microsoft, but the time spent would be
lost for the company I work for. Finally I'm obvioulsy not allowed to
send our database model in this newsgroup.

I remain convinced that this bug should be reproduced easily:
* Create a complex materialized view, that performs at least 4-5 inner
joins on high-volume tables.
* Add multiple 'count_big' and 'group by' to this mat view. In my
case, I had 5 count_big like :

count_big(CASE WHEN (fi.txtStatus = 'New') THEN 1 ELSE NULL END ) as
IssueTotalNew )

* Insert new records to its underlying tables without interruption for
at least 30minutes.

Please let me know if you have more information about this bug.

Thanks,

Vincent LIDOU

"Ryan Stonecipher [MSFT]" <ry******@onlin e.microsoft.com > wrote in message news:<40******* *@news.microsof t.com>...
Vincent,

Please open a support case with SQL Server support, and they can help
you to diagnose/work around/get a fix for this problem.

Thanks,
Ryan Stonecipher
SQL Server Storage Engine.

Jul 20 '05 #5
On 9 Jun 2004 22:06:22 -0700, vl****@laposte. net (Vincent LIDOU) wrote:
Thanks for your answers.

My problem is the following: even if Microsoft can provide us with a
fix, I wouldn't be allowed to install it on our porduction servers (we
can only install service packs). Also, I wish I could spend more time
I don't mean the following in an agressive way or to be demeaning to you at
all, but ... Rules are just words on paper. Immutable rules are poison. If
your company isn't flexible enough to make exceptions in special cases for
core business reasons, it'll go the way of the dinosaur. Have you asked if an
exception could be made if there was a busniness value case for it? Perhaps,
your comany is more flexible than you think.
tracking down this bug with Microsoft, but the time spent would be
lost for the company I work for. Finally I'm obvioulsy not allowed to
send our database model in this newsgroup.
If you can reproduce the problem with other data, you don't have to send your
data to anyone.
I remain convinced that this bug should be reproduced easily:
* Create a complex materialized view, that performs at least 4-5 inner
joins on high-volume tables.
The only way you should ever be convinced of that is if you've reproduced it
in this way. Once you have, you can submit that to Microsoft. That's just
the way the world works - you get help after you can demonstrate the problem
for tech support. It's not hard to populate a fat table with random data for
testing purposes.
* Add multiple 'count_big' and 'group by' to this mat view. In my
case, I had 5 count_big like :


Relax - repro the problem, and get help from MS. Convince your company, you
need the patch from MS now, and not wait for it to be included in a service
pack. If MS is still unhelpful, then you can come back here, and bad-mouth MS
all you want. I'm not saying Microsoft wil definitely give you satisfaction,
but you have to jump through the requisite hoops first, if you want to have
any hope of getting your problem fixed. If you have no confidence Microsoft
can help you, don't bother - convince your company to switch to oracle or
PostgreSql - or quit.
Jul 20 '05 #6
Vincent LIDOU (vl****@laposte .net) writes:
My problem is the following: even if Microsoft can provide us with a
fix, I wouldn't be allowed to install it on our porduction servers (we
can only install service packs).
That is obviously your problem. But as Steve Jorgensen pointed out,
this is a trade-off. If this bug is business-critical to your
organisation, you should certainly make an exception from the rule.
Then again, if this is a problem you can live with, your strategy to
install only service packs is not a bad one. Although there are
several post-SP3 available for public download, they have not been
subject to the same level of regression testing as a true hotfix, so
there is certainly an increased risk for other surprises.

Also, I wish I could spend more time tracking down this bug with
Microsoft, but the time spent would be lost for the company I work for.
...
I remain convinced that this bug should be reproduced easily:
I'm sorry, but this is not how the world works. If you are not
prepared to spend the time to investigate this, don't expect anyone else
to do so. You have the view, and you have the problem. I am not going
to create complex indexed view just for a guess to see if the problem
appears. There might be something very special in your setup which
is the source of the problem. In fact, I don't want to rule out that
this may also be related to your hardware configuration. But if you
would give me a repro that you know demonstrates the problem, and I
would not be able to reproduce it, that would at least be a clue.

And mind you, any time I spend on this, is of no profit to my company,
but this is something I do in my spare time.

But if you are not interested in pursuing the issue, let's drop it.
But it would be a pity, because if there is indeed a bug, then MS
would like to make sure that at very least it is not in the next version
of SQL Server.
Finally I'm obvioulsy not allowed to send our database model in this >
newsgroup.


And no one is expecting to do so. To get the issue out here, you would
have to carve out a view similar to the one you have in production. Yes,
that would be a couple of hours of work, but I am afraid that unless
you open a case with Microsoft, no one else will do it. (I'm assuming
that you would give the MS Support Engineer access to the database.)

And, oh, running a couple of integrity checks on the database may be
a good idea.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #7

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

Similar topics

4
13576
by: Prashant | last post by:
Hi I have a problem with refreshing of Mviews , I will narrate every thing step by step: 1.create table a (a number); 2.insert into table a values(&a); (after inserting 2 rows and commiting) 3. create MATERIALIZED view b REFRESH WITH ROWID START WITH SYSDATE NEXT sysdate + 2/1440 as select * from a;
2
3466
by: bdjensen | last post by:
Hi! I have an select on a view that takes too much time. The view include joins. I tried index-analysis and explain-plan, but this don't help. But it helped when making a real table (select * into realtable from bigview) and afterwards making my select on realtable...? Suggestions? Where to read more about it? Greetings
2
7341
by: Avirneni | last post by:
With my understanding of indexed views and according to books I read "indexed views" are supposed to perform much better than "temp tables" (temp table having primary key and indexed view with clustered index on the same keys). But when I tried in my system I am getting opposite results. With Indexed Views it takes 3 times more time. Any body has any reasons for that? Or my understanding was wrong?
3
2437
by: teddysnips | last post by:
This from a SQL Server manual: "Complex queries, however, such as those in decision support systems, can reference large numbers of rows in base tables and aggregate large amounts of information into relatively concise aggregates (such as sums or averages). SQL Server 2000 supports creating a clustered index on a view that implements such a complex query. When the CREATE INDEX statement is executed, the result set of the view SELECT is...
3
1805
by: noelwatson | last post by:
I am looking to create a constraint on a table that allows multiple nulls but all non-nulls must be unique. I found the following script http://www.windowsitpro.com/Files/09/21293/Listing_01.txt that works fine, but the following line CREATE UNIQUE CLUSTERED INDEX idx1 ON v_multinulls(a)
6
12271
by: Bruce | last post by:
I want to create a new table based on an existing table, but I don't want the tables to have any enforced relationship. Is this possible without having to do a CREATE TABLE and an INSERT? create table customer_Temp as (select credit_Card_number, personal_id_number from customer) DATA INITIALLY DEFERRED REFRESH deferred; refresh table customer_temp;
7
4192
by: Esteban Kemp | last post by:
PostgreSql support materialized views ??? if not, there is something similar?? Thanks Esteban kemp
1
3058
by: rumasinha | last post by:
Hi, I first created a materialized view that was based on the org striped views like po_headers hence the automatic refresh was not happening. After automatic complete refresh, the materialized view was showing null records. Hence I based the materialized view on "_all" tables and then based a view on this materialized view and this view I made org striped. In the materialized view , I was refering to...
1
2083
by: Pink Panther | last post by:
Hi All, Sorry this may be a repost as first attempt died on me... I have a set of 50 materialized views that are populated every morning. However 2 of the materialized views contain no records (I know the master does contain records). None of the jobs are broken and all run as scheduled.
0
7991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8398
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
8265
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6719
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
5850
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
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3898
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
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1250
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.