SELECT OBJECT_NAME(ind.OBJECT_ID) AS TableName,
ind.name AS IndexName, indexstats.index_type_desc AS IndexType,
indexstats.avg_fragmentation_in_percent, indexstats.fragment_count
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats
INNER JOIN sys.indexes ind
ON ind.object_id = indexstats.object_id
AND ind.index_id = indexstats.index_id
WHERE indexstats.avg_fragmentation_in_percent > 10 and indexstats.fragment_count > 50
ORDER BY indexstats.avg_fragmentation_in_percent DESC
fredag den 27. februar 2015
SQL Check index fragmentation
SQL Index optimizing job
{
IF OBJECT_ID('tempdb..#work_to_do') IS NOT NULL
DROP TABLE tempdb..#work_to_do
BEGIN TRY
--BEGIN TRAN
use [your Database]
-- Ensure a USE statement has been executed first.
SET NOCOUNT ON;
DECLARE @objectid INT;
DECLARE @indexid INT;
DECLARE @partitioncount BIGINT;
DECLARE @schemaname NVARCHAR(130);
DECLARE @objectname NVARCHAR(130);
DECLARE @indexname NVARCHAR(130);
DECLARE @partitionnum BIGINT;
DECLARE @partitions BIGINT;
DECLARE @frag FLOAT;
DECLARE @pagecount INT;
DECLARE @command NVARCHAR(4000);
DECLARE @page_count_minimum SMALLINT
SET @page_count_minimum = 50
DECLARE @fragmentation_minimum FLOAT
SET @fragmentation_minimum = 30.0
-- Conditionally select tables and indexes from the sys.dm_db_index_physical_stats function
-- and convert object and index IDs to names.
SELECT object_id AS objectid ,
index_id AS indexid ,
partition_number AS partitionnum ,
avg_fragmentation_in_percent AS frag ,
page_count AS page_count
INTO #work_to_do
FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL,
'LIMITED')
WHERE avg_fragmentation_in_percent > @fragmentation_minimum
AND index_id > 0
AND page_count > @page_count_minimum;
IF CURSOR_STATUS('global', 'partitions') >= -1
BEGIN
PRINT 'partitions CURSOR DELETED' ;
CLOSE partitions
DEALLOCATE partitions
END
-- Declare the cursor for the list of partitions to be processed.
DECLARE partitions CURSOR LOCAL
FOR
SELECT *
FROM #work_to_do;
-- Open the cursor.
OPEN partitions;
-- Loop through the partitions.
WHILE ( 1 = 1 )
BEGIN;
FETCH NEXT
FROM partitions
INTO @objectid, @indexid, @partitionnum, @frag, @pagecount;
IF @@FETCH_STATUS < 0
BREAK;
SELECT @objectname = QUOTENAME(o.name) ,
@schemaname = QUOTENAME(s.name)
FROM sys.objects AS o
JOIN sys.schemas AS s ON s.schema_id = o.schema_id
WHERE o.object_id = @objectid;
SELECT @indexname = QUOTENAME(name)
FROM sys.indexes
WHERE object_id = @objectid
AND index_id = @indexid;
SELECT @partitioncount = COUNT(*)
FROM sys.partitions
WHERE object_id = @objectid
AND index_id = @indexid;
SET @command = N'ALTER INDEX ' + @indexname + N' ON '
+ @schemaname + N'.' + @objectname + N' REBUILD';
IF @partitioncount > 1
SET @command = @command + N' PARTITION='
+ CAST(@partitionnum AS NVARCHAR(10));
EXEC (@command);
--print (@command); //uncomment for testing
PRINT N'Rebuilding index ' + @indexname + ' on table '
+ @objectname;
PRINT N' Fragmentation: ' + CAST(@frag AS VARCHAR(15));
PRINT N' Page Count: ' + CAST(@pagecount AS VARCHAR(15));
PRINT N' ';
END;
-- Close and deallocate the cursor.
CLOSE partitions;
DEALLOCATE partitions;
-- Drop the temporary table.
DROP TABLE #work_to_do;
--COMMIT TRAN
END TRY
BEGIN CATCH
--ROLLBACK TRAN
PRINT 'ERROR ENCOUNTERED:' + ERROR_MESSAGE()
END CATCH
}
onsdag den 18. juni 2014
New owner at Sampdoria
New Sampdoria President Massimo Ferrero has promised fans marvellous victories and spectacular football following his takeover of the club.
The film-producer has bought the Luigi Ferraris side from pervious President Edoardo Garrone and, at a Press conference to announce the handover of control, the Blucerchiati fan paid tribute to his predecessor.
"I'm very honoured to be wearing this shirt," Ferrero, sporting a Samp jersey, told reporters.
"All I can say is thank you to Edoardo Garrone and his family, who have always had Sampdoria in their interests.
"I've produced 60 films and filmed 150. I've acquired Sampdoria because after Sampdoria there is nothing. I've won every prize in cinema there is to be won.
"I'm a Sampdoria fan and it's been two-and-a-half years that I've followed this dream. Garrone is very nice, a person of great humanity and at our first meeting he was very excited.
"Garrone is more important than Obama, he had a protocol to fulfil and it was fulfilled!
"Replicating Mantovani and Garrone is impossible, they are irreplaceable. They are people who have made Italy. I will be happy if I manage to continue the journey."
The new President then discussed what he hopes to bring to the club and spoke glowingly about Samp Coach Sinisa Mihajlovic.
"I can guarantee Sampdoria some marvellous victories and all I want to do is win.
"I still need to meet all the staff. Mihajlovic is the best Coach, the number one, I am one of his fans. I have two models - Garrone and Mihajlovic.
"On the transfer market, I hope the fans are not expecting a bang but they can expect a surprise.
"I want to bring spectacular football and I will look to focus on two things – the business and the spectacle, because the two things must be parallel."
onsdag den 20. november 2013
tirsdag den 12. november 2013
mandag den 17. december 2012
Ciro Ferrara sacked
torsdag den 30. august 2012
Sampdoria quick update season 2012
Enzo Maresca (Malaga)
Andrea Poli (loaned out to inter last season ,want's to go, but clock is ticking)
Ciro Ferrara is the new head coach