.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

update statistics with fullscan and number of steps in histogram;

Posted By:      Posted Date: October 23, 2010    Points: 0   Category :Sql Server
 

Hi I have a sql 2008 EE x64 sp1 on win 2008 x64. For a pk statistics, when I run update statistics with fullscan the number of steps in histogram drops from say 150 to less than 5? Is there any eason behind this? why would the number of steps drop instead of increase when i do an update with fullscan?

Thanks

I have currently

Name         Updated                             Rows                     RowsSampled      Steps.......

PK_Index Oct 22 2010 10:52PM            2634160                   158634             178               1 16 NO

But after I run update statistics with full scan I have only 3 steps?

Name          Updated &n


View Complete Post


More Related Resource Links

Maintenance Update Statistics plan

  
Hi, I've created a maintenance plan for many databases with these tasks (SQL 2005) 1- shrink Database 2- Update Statistics 3- Cleanup History 4- Backup Database (Full) 5- Maintenance Cleanup task The maintenance plan failed at task Update Statics.  Here the error message : Error number : -1073548784 Error message : Executing the query "UPDATE STATISTICS [dbo].[LOG_DETAILS] WITH FULLSCAN " failed with the following error: "Could not continue scan with NOLOCK due to data movement.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. My question :How do I know which database is causing the problem and how can I fix the problem ? I don't know a dbo database? thanks,   Jasmin  

Re-indexing or update statistics after purging data

  
All,   I’m purging 250GB from a 1TB Multi SQL server databases in one weekend.   After running a re-indexing job do I have to run update statistics?   It takes about 5 hours to run 5% stats, so it will take a loooong time to do 100%.   I have been told that I don’t need to run update stats if I ran Re-Indexing, What do you think?

Re-index or update statistics after purging data

  
All,   I’m purging 250GB from a 1TB Multi SQL server databases in one weekend.   After running a re-indexing job do I have to run update statistics?   It takes about 5 hours to run 5% stats, so it will take a loooong time to do 100%.   I have been told that I don’t need to run update stats if I ran Re-Indexing, What do you think?

Cumulative Update 5 - wrong SQL 2008 version number

  

Hi all,

I installed Service Pack 1 for SQL 2008 on one of my servers. This server has multiple instances. In this case, it is the instance "SHAREPOINT2010" that is giving me difficulties.

For Sharepoint 2010, we need to install cumulative update 5. This update fails due to the fact I do not have the correct SQL version. It is expecting version 10.0.2531 (SP1), but it says I have the 10.0.1600 (RTM). When I check in my management studio and via the @@version, I do see the confirmation I have version 10.0.2531. (also see attached screenshot).

Does anyone know why the cumulative update fails to see the correct server version ? If I try to install it on another SQL 2008 SP1, it works fine..;

Thank you !

Koen

 

screenshot sql version

SQL Server Maintenance Plan - Update Statistics fails if schema contains special chars

  

We have a database schema with a period in it's name.  This is valid as per http://msdn.microsoft.com/en-us/library/aa224033(SQL.80).aspx. When we create a maintenance plan to update statistics it will succeed if the object property is set to 'Tables and Views'. If this is set to 'Table' it will fail.

Steps to Reproduce

  • Create a new schema in a user database with a period in it's name, ie
    CREATE SCHEMA [Windows.EventLog] AUTHORIZATION [dbo]
  • Create a table with owner using schema created in #1, ie
    CREATE TABLE [Windows.EventLog].[Computer](
    
    	[ComputerId] [smallint] IDENTITY(1,1) NOT NULL,
    
    	[ComputerName] [varchar](255) NOT NULL,
    
     CONSTRAINT [PK_Computer] PRIMARY KEY CLUSTERED ([ComputerId] ASC)
    
    ) ON [PRIMARY]
    
    
  • Create a new maintenance plan, drag 'Update Statistics Task' to designer surface, edit properites, choose the user database, View T-SQL and test execution: it will work
  • Edit maintenance plan and modify 'Update Statistics Task', change Object to Table, change selection to all, execute task and it will fail. Also, if you now try to click 'View T-SQL' or change it back to 'Tables and Views', a error dialog with title 'Microsoft.SqlServer.MaintenancePlanTasksUI' shows will message 'Object

UPDATE STATISTICS - Could not allocate space for object - Tempdb

  

Hi Everyone

I have scheduled a maintenance plan for index & update stats one after another.  Now-a-days this job is failing with below error.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error Number: -1073548784

Executing the query "UPDATE STATISTICS [dbo].[***********]
WITH FULLSCAN
" failed with the following error: "Could not allocate space for object 'dbo.SORT temporary run
storage:  142101814116352' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tables & Index Details

name rows reserved data index_size unused

*** 46613190 44534360 KB 37240624 KB 7293248 KB 488 KB

in update statistics the sampling taken is 100% even if less is specified

  

SQL Server 2005 SP3 / SQL Server 2008 SP1 : EVALUATION EDITION in both cases

Auto update stats was set to false >>I created the table >> the column was a primary key so the stats was created on the primary key column >> I inserted 10000 rows >> i updated the statistics WITH SAMPLE 5 PERCENT

I ran dbcc show_statistics and it shows me 100% sampling .

I created another stats on a new column >> and updated it with SAMPLE 30 PERCENT ...

I ran dbcc show_statistics and it shows me 100% sampling .

Is it something I am missing here ....


Abhay Chaudhary OCP 9i, MCTS/MCITP (SQL Server 2005, 2008, 2005 BI) ms-abhay.blogspot.com/

Update statistics and cache plan invalidation

  

Hi,

I assumed that whenever we run update statistics on the database tables it would invalidate all the plans in cache involving those tables and SQL Server would generate a new execution plan for queries involving those tables but this is not a behavior we are getting on test system.

Let me know if this assumption is not true and we need to clear cache after running update statistics to make sure SQL Server generates optimal plan with new statistics.

Following is the sample code I tried on SQL Server 2005sp3:

drop table test_stats
create table test_stats(id int not null primary key, id1 int, id2 int, id3 char(1000))
create index idx_dd1 on test_stats(id1)
--The following statement would generate execution plan with full scan on test_stats
select * from test_stats where id1 = 100
set nocount on
declare @i int
set @i = 1
while (@i < 10000)
begin
insert into test_stats values(@i,@i,@i,@i)
set @i = @i+1
end
update statistics test_stats with fullscan
--The following statement still generates execution plan with full scan on test_stats even after updating statistics
select * from test_stats where id1 = 100
dbcc freeproccache
--The following statement generates execution plan with index seek after clearing cache
select * from test_st

Large number of Insert and Update commands

  

I have a task where I need to grab commands from an XML file, process the commands into SQL Insert/Update commands and then send the insert/updates on the SQL Server.  My problem is there can be hundreds of thousands of Insert/Update commands coming from the XML file and some of the insert and update commands can not be decoupled.  For example there is a command where I need to insert values accross multiple tables and need to use something like SELECT @DataID = scope_identity(); in the query.  What is the best way to execute large amounts of INSERT/UPDATE commands where some of the commands cannot be decoupled.

 


Rebuild Index and Update Column Statistics

  

As Index rebuild process will create and update stats, we should not update stats as the row sampling would be less than ideal. However, here is my question. Would a column Stats need to be updated after a Index Rebuild.

If yes, why, if no why. Please provide some documentation to get a better understanding of this with the help of an example. 

Thank you.


The number of calls to the Changed event for a single update in the data exceeded the maximum limit.

  

Dear All,

We have hit the big limit of 16 change events per single update.  Is there any way to extend this to say 25, we are not using infinate loops or anything.

Alternatively, is it possible to disable some change events when values are updated?

Thanks

William Man


A better way to reference your wizard steps using named steps

  
Note: this article uses the plain vanilla but the concepts apply equally well to its popular counterpart .

By far the most common way that I see wizard steps reference in code snippets is by their index.

ASP.Net Gridview Edit Update Cancel Commands

  
In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

How to format and update GridView and DataGrid rows using JQuery

  
The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Update Vs SystemUpdate

  
Many of you might noticed that share point ListItem has Update() method as well as SystemUpdate().

What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

  
Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?



Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.



For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

Convert English to Arabic number without changing any regional settings in .net

  
Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend