I have a financial database which tracks charges and payments form clients.
I need to create a query which returns only those months when a client
hasn't paid in full and the amount still owing. So, if the table looks like
this:
client date(mm/dd/yyyy) charge
payment
smith 12/01/2006 400.00
smith 12/23/2006
250.00
smith 12/28/2005
50.00
smith 01/01/2006 400.00
smith 01/13/2006
400.00
jones 02/01/2006 400.00
jones 02/05/2006
350.00
the resulting data would look like this:
smith 12/2005 100.00
jones 02/2006 50.00
thanks.
steve.Since you didn't provide DDL or insert scripts this is what I cooked up
I don't think the data for smith is correct, and what is the full
amount? 800?
create table blah (client varchar(50),date datetime, charge decimal
(10,2))
insert into blah
select 'smith', '12/01/2006', 400.00 union all
select 'smith', '12/23/2006', 250.00 union all
select 'smith' , '12/28/2005', 50.00 union all
select 'smith' , '01/01/2006', 400.00 union all
select 'smith' , '01/13/2006', 400.00 union all
select 'jones' , '02/01/2006', 400.00 union all
select 'jones' , '02/05/2006', 350.00
select client,800 -sum(charge) ,datepart(m,date) ,datepart(yyyy,date)
from blah
group by client,datepart(m,date),datepart(yyyy,da
te)
having sum(charge) < 800
http://sqlservercode.blogspot.com/|||SELECT
CLIENT,CONVERT(VARCHAR,DATEPART(mm,getda
te()))+'/'+CONVERT(VARCHAR,DATEPART(
year,getdate())) AS MONTHYEAR, CHARGE
WHERE CHARGE <= 100
Lemme me know if this is what your are looking for...
Thanks,
Sree
"molsonexpert" wrote:
> I have a financial database which tracks charges and payments form clients
.
> I need to create a query which returns only those months when a client
> hasn't paid in full and the amount still owing. So, if the table looks lik
e
> this:
> client date(mm/dd/yyyy) charge
> payment
> smith 12/01/2006 400.00
> smith 12/23/2006
> 250.00
> smith 12/28/2005
> 50.00
> smith 01/01/2006 400.00
> smith 01/13/2006
> 400.00
> jones 02/01/2006 400.00
> jones 02/05/2006
> 350.00
> the resulting data would look like this:
> smith 12/2005 100.00
> jones 02/2006 50.00
> thanks.
> steve.
>
>|||select client
, max(date) as LastActivityDate
-- Assuming the last date soemthign happened is the one you want to show
, sum(charge-payment) as Balance
-- above can also be:
--, Sum(charge) - sum(payment) as Balance
from MyPaymentsTable
group by client
having sum(charge-payment) <> 0
-- the above returns anyone with a credit or debit balance
-- the below returns only clients who owe money
-- or having sum(charge-payment) > 0
"molsonexpert" <imdrunk@.work.ca> wrote in message
news:%23bQ2OayKGHA.952@.TK2MSFTNGP10.phx.gbl...
> I have a financial database which tracks charges and payments form
clients.
> I need to create a query which returns only those months when a client
> hasn't paid in full and the amount still owing. So, if the table looks
like
> this:
> client date(mm/dd/yyyy) charge
> payment
> smith 12/01/2006 400.00
> smith 12/23/2006
> 250.00
> smith 12/28/2005
> 50.00
> smith 01/01/2006 400.00
> smith 01/13/2006
> 400.00
> jones 02/01/2006 400.00
> jones 02/05/2006
> 350.00
> the resulting data would look like this:
> smith 12/2005 100.00
> jones 02/2006 50.00
> thanks.
> steve.
>|||-- This return months where the clients
-- charges exceed the payments. I'm
-- assuming that in your test data, the two entries for
-- 'smith' in december should be for 2005 not 2006
SELECT Client,
DATEPART(year,thedate),
DATEPART(month,thedate),
SUM(COALESCE(Charge,0)-COALESCE(Payment,0))
FROM ChargesAndPayments
GROUP BY client,
DATEPART(year,thedate),
DATEPART(month,thedate)
HAVING SUM(COALESCE(Charge,0)-COALESCE(Payment,0))>0|||I should have included the isnull or coalesce around the charge and payment
fields as markc600 did below.
Without the isnull or coalesce, you will get back nulls instead of the
correct values.
"Jim Underwood" <james.underwoodATfallonclinic.com> wrote in message
news:%23x5XzwyKGHA.3260@.TK2MSFTNGP11.phx.gbl...
> select client
> , max(date) as LastActivityDate
> -- Assuming the last date soemthign happened is the one you want to show
> , sum(charge-payment) as Balance
> -- above can also be:
> --, Sum(charge) - sum(payment) as Balance
> from MyPaymentsTable
> group by client
> having sum(charge-payment) <> 0
> -- the above returns anyone with a credit or debit balance
> -- the below returns only clients who owe money
> -- or having sum(charge-payment) > 0
> "molsonexpert" <imdrunk@.work.ca> wrote in message
> news:%23bQ2OayKGHA.952@.TK2MSFTNGP10.phx.gbl...
> clients.
> like
>
Showing posts with label clients. Show all posts
Showing posts with label clients. Show all posts
Friday, March 30, 2012
Friday, February 24, 2012
Help with Logical Fragmentation
I am having a look at the performance issues on a clients Website analysis
tool database which currently stands at 440 GB and as a result have not run
the optimisation or integrity checking parts of the maintenance plan for a
long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
(finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
the table but did not touch the first row. So what I want to know is A) What
this first row represents and check that it should be as low as possible and
B) what command will reduced it.
Thanks in Advance Russell
This is on a SQL Server 2000 SP3a server.
"Russell" wrote:
> I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
> the table but did not touch the first row. So what I want to know is A) What
> this first row represents and check that it should be as low as possible and
> B) what command will reduced it.
> Thanks in Advance Russell
|||The largest table with issue is globalvb_Visits and when I run DBCC
SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
output I get is listed below.
ObjectId
1382950102
IndexName
IndexId
0
Level
0
Pages
547631
Rows
27929035
MinimumRecordSize
149
MaximumRecordSize
149
AverageRecordSize
149
ForwardedRecords
0
Extents
68465
ExtentSwitches
68464
AverageFreeBytes
395.0390015
AveragePageDensity
95.11936188
ScanDensity
99.9839334
BestCount
68454
ActualCount
68465
LogicalFragmentation
99.99981689
ExtentFragmentation
27.22558975
|||From the results ...it looks globalvb_Visits has no indexes?
The scandensity looks fine.
That should be between the 75 and 100%.
"Russell" wrote:
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
|||I would also check out your OS disk file fragmentation. If default settings
for size and growth were used for the initial database, you will have
several hundred thousand 1MB fragments of your data file all over the disk.
I had a client with that problem and a simple defrag resulted in an 18%
throughput improvement!!
TheSQLGuru
President
Indicium Resources, Inc.
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not
> run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I
> presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> on
> the table but did not touch the first row. So what I want to know is A)
> What
> this first row represents and check that it should be as low as possible
> and
> B) what command will reduced it.
> Thanks in Advance Russell
|||I will have a look at the disk fragmentation.
There are 4 indexes on the table and running DBCC DBRENINDEX against the
table reduces their logical fragmentation to 0%.
"TheSQLGuru" wrote:
> I would also check out your OS disk file fragmentation. If default settings
> for size and growth were used for the initial database, you will have
> several hundred thousand 1MB fragments of your data file all over the disk.
> I had a client with that problem and a simple defrag resulted in an 18%
> throughput improvement!!
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> "Russell" <Russell@.discussions.microsoft.com> wrote in message
> news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>
>
|||Hi Russell
IndexID 0 indicates this table is a heap, which by definition has no
organization to it.
The purpose of DBCC INDEXDEFRAG is to make the physical order of pages in an
INDEX match the logical order, but since your table has no logical order,
DBCC INDEXDEFRAG will have no effect.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:9E83AC0A-1706-46A9-A525-DCD1B8E9B392@.microsoft.com...
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
tool database which currently stands at 440 GB and as a result have not run
the optimisation or integrity checking parts of the maintenance plan for a
long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
(finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
the table but did not touch the first row. So what I want to know is A) What
this first row represents and check that it should be as low as possible and
B) what command will reduced it.
Thanks in Advance Russell
This is on a SQL Server 2000 SP3a server.
"Russell" wrote:
> I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
> the table but did not touch the first row. So what I want to know is A) What
> this first row represents and check that it should be as low as possible and
> B) what command will reduced it.
> Thanks in Advance Russell
|||The largest table with issue is globalvb_Visits and when I run DBCC
SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
output I get is listed below.
ObjectId
1382950102
IndexName
IndexId
0
Level
0
Pages
547631
Rows
27929035
MinimumRecordSize
149
MaximumRecordSize
149
AverageRecordSize
149
ForwardedRecords
0
Extents
68465
ExtentSwitches
68464
AverageFreeBytes
395.0390015
AveragePageDensity
95.11936188
ScanDensity
99.9839334
BestCount
68454
ActualCount
68465
LogicalFragmentation
99.99981689
ExtentFragmentation
27.22558975
|||From the results ...it looks globalvb_Visits has no indexes?
The scandensity looks fine.
That should be between the 75 and 100%.
"Russell" wrote:
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
|||I would also check out your OS disk file fragmentation. If default settings
for size and growth were used for the initial database, you will have
several hundred thousand 1MB fragments of your data file all over the disk.
I had a client with that problem and a simple defrag resulted in an 18%
throughput improvement!!
TheSQLGuru
President
Indicium Resources, Inc.
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not
> run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I
> presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> on
> the table but did not touch the first row. So what I want to know is A)
> What
> this first row represents and check that it should be as low as possible
> and
> B) what command will reduced it.
> Thanks in Advance Russell
|||I will have a look at the disk fragmentation.
There are 4 indexes on the table and running DBCC DBRENINDEX against the
table reduces their logical fragmentation to 0%.
"TheSQLGuru" wrote:
> I would also check out your OS disk file fragmentation. If default settings
> for size and growth were used for the initial database, you will have
> several hundred thousand 1MB fragments of your data file all over the disk.
> I had a client with that problem and a simple defrag resulted in an 18%
> throughput improvement!!
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> "Russell" <Russell@.discussions.microsoft.com> wrote in message
> news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>
>
|||Hi Russell
IndexID 0 indicates this table is a heap, which by definition has no
organization to it.
The purpose of DBCC INDEXDEFRAG is to make the physical order of pages in an
INDEX match the logical order, but since your table has no logical order,
DBCC INDEXDEFRAG will have no effect.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:9E83AC0A-1706-46A9-A525-DCD1B8E9B392@.microsoft.com...
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
Labels:
analysistool,
clients,
database,
fragmentation,
logical,
microsoft,
mysql,
oracle,
performance,
server,
sql,
stands,
website
Help with Logical Fragmentation
I am having a look at the performance issues on a clients Website analysis
tool database which currently stands at 440 GB and as a result have not run
the optimisation or integrity checking parts of the maintenance plan for a
long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
(finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
the table but did not touch the first row. So what I want to know is A) What
this first row represents and check that it should be as low as possible and
B) what command will reduced it.
Thanks in Advance RussellThis is on a SQL Server 2000 SP3a server.
"Russell" wrote:
> I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
> the table but did not touch the first row. So what I want to know is A) What
> this first row represents and check that it should be as low as possible and
> B) what command will reduced it.
> Thanks in Advance Russell|||The largest table with issue is globalvb_Visits and when I run DBCC
SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
output I get is listed below.
ObjectId
1382950102
IndexName
IndexId
0
Level
0
Pages
547631
Rows
27929035
MinimumRecordSize
149
MaximumRecordSize
149
AverageRecordSize
149
ForwardedRecords
0
Extents
68465
ExtentSwitches
68464
AverageFreeBytes
395.0390015
AveragePageDensity
95.11936188
ScanDensity
99.9839334
BestCount
68454
ActualCount
68465
LogicalFragmentation
99.99981689
ExtentFragmentation
27.22558975|||From the results ...it looks globalvb_Visits has no indexes?
The scandensity looks fine.
That should be between the 75 and 100%.
"Russell" wrote:
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>|||I would also check out your OS disk file fragmentation. If default settings
for size and growth were used for the initial database, you will have
several hundred thousand 1MB fragments of your data file all over the disk.
I had a client with that problem and a simple defrag resulted in an 18%
throughput improvement!!
--
TheSQLGuru
President
Indicium Resources, Inc.
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not
> run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I
> presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> on
> the table but did not touch the first row. So what I want to know is A)
> What
> this first row represents and check that it should be as low as possible
> and
> B) what command will reduced it.
> Thanks in Advance Russell|||I will have a look at the disk fragmentation.
There are 4 indexes on the table and running DBCC DBRENINDEX against the
table reduces their logical fragmentation to 0%.
"TheSQLGuru" wrote:
> I would also check out your OS disk file fragmentation. If default settings
> for size and growth were used for the initial database, you will have
> several hundred thousand 1MB fragments of your data file all over the disk.
> I had a client with that problem and a simple defrag resulted in an 18%
> throughput improvement!!
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> "Russell" <Russell@.discussions.microsoft.com> wrote in message
> news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
> >I am having a look at the performance issues on a clients Website analysis
> > tool database which currently stands at 440 GB and as a result have not
> > run
> > the optimisation or integrity checking parts of the maintenance plan for a
> > long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> > TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> > blank Indexname and also reports a 99.993% Logical Fragmentation. I
> > presume
> > that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> > (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> > on
> > the table but did not touch the first row. So what I want to know is A)
> > What
> > this first row represents and check that it should be as low as possible
> > and
> > B) what command will reduced it.
> >
> > Thanks in Advance Russell
>
>|||Hi Russell
IndexID 0 indicates this table is a heap, which by definition has no
organization to it.
The purpose of DBCC INDEXDEFRAG is to make the physical order of pages in an
INDEX match the logical order, but since your table has no logical order,
DBCC INDEXDEFRAG will have no effect.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:9E83AC0A-1706-46A9-A525-DCD1B8E9B392@.microsoft.com...
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
tool database which currently stands at 440 GB and as a result have not run
the optimisation or integrity checking parts of the maintenance plan for a
long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
(finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
the table but did not touch the first row. So what I want to know is A) What
this first row represents and check that it should be as low as possible and
B) what command will reduced it.
Thanks in Advance RussellThis is on a SQL Server 2000 SP3a server.
"Russell" wrote:
> I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
> the table but did not touch the first row. So what I want to know is A) What
> this first row represents and check that it should be as low as possible and
> B) what command will reduced it.
> Thanks in Advance Russell|||The largest table with issue is globalvb_Visits and when I run DBCC
SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
output I get is listed below.
ObjectId
1382950102
IndexName
IndexId
0
Level
0
Pages
547631
Rows
27929035
MinimumRecordSize
149
MaximumRecordSize
149
AverageRecordSize
149
ForwardedRecords
0
Extents
68465
ExtentSwitches
68464
AverageFreeBytes
395.0390015
AveragePageDensity
95.11936188
ScanDensity
99.9839334
BestCount
68454
ActualCount
68465
LogicalFragmentation
99.99981689
ExtentFragmentation
27.22558975|||From the results ...it looks globalvb_Visits has no indexes?
The scandensity looks fine.
That should be between the 75 and 100%.
"Russell" wrote:
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>|||I would also check out your OS disk file fragmentation. If default settings
for size and growth were used for the initial database, you will have
several hundred thousand 1MB fragments of your data file all over the disk.
I had a client with that problem and a simple defrag resulted in an 18%
throughput improvement!!
--
TheSQLGuru
President
Indicium Resources, Inc.
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not
> run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I
> presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> on
> the table but did not touch the first row. So what I want to know is A)
> What
> this first row represents and check that it should be as low as possible
> and
> B) what command will reduced it.
> Thanks in Advance Russell|||I will have a look at the disk fragmentation.
There are 4 indexes on the table and running DBCC DBRENINDEX against the
table reduces their logical fragmentation to 0%.
"TheSQLGuru" wrote:
> I would also check out your OS disk file fragmentation. If default settings
> for size and growth were used for the initial database, you will have
> several hundred thousand 1MB fragments of your data file all over the disk.
> I had a client with that problem and a simple defrag resulted in an 18%
> throughput improvement!!
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> "Russell" <Russell@.discussions.microsoft.com> wrote in message
> news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
> >I am having a look at the performance issues on a clients Website analysis
> > tool database which currently stands at 440 GB and as a result have not
> > run
> > the optimisation or integrity checking parts of the maintenance plan for a
> > long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> > TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> > blank Indexname and also reports a 99.993% Logical Fragmentation. I
> > presume
> > that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> > (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> > on
> > the table but did not touch the first row. So what I want to know is A)
> > What
> > this first row represents and check that it should be as low as possible
> > and
> > B) what command will reduced it.
> >
> > Thanks in Advance Russell
>
>|||Hi Russell
IndexID 0 indicates this table is a heap, which by definition has no
organization to it.
The purpose of DBCC INDEXDEFRAG is to make the physical order of pages in an
INDEX match the logical order, but since your table has no logical order,
DBCC INDEXDEFRAG will have no effect.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:9E83AC0A-1706-46A9-A525-DCD1B8E9B392@.microsoft.com...
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
Help with Logical Fragmentation
I am having a look at the performance issues on a clients Website analysis
tool database which currently stands at 440 GB and as a result have not run
the optimisation or integrity checking parts of the maintenance plan for a
long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
(finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
the table but did not touch the first row. So what I want to know is A) What
this first row represents and check that it should be as low as possible and
B) what command will reduced it.
Thanks in Advance RussellThis is on a SQL Server 2000 SP3a server.
"Russell" wrote:
> I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not ru
n
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I presum
e
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes o
n
> the table but did not touch the first row. So what I want to know is A) Wh
at
> this first row represents and check that it should be as low as possible a
nd
> B) what command will reduced it.
> Thanks in Advance Russell|||The largest table with issue is globalvb_Visits and when I run DBCC
SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
output I get is listed below.
ObjectId
1382950102
IndexName
IndexId
0
Level
0
Pages
547631
Rows
27929035
MinimumRecordSize
149
MaximumRecordSize
149
AverageRecordSize
149
ForwardedRecords
0
Extents
68465
ExtentSwitches
68464
AverageFreeBytes
395.0390015
AveragePageDensity
95.11936188
ScanDensity
99.9839334
BestCount
68454
ActualCount
68465
LogicalFragmentation
99.99981689
ExtentFragmentation
27.22558975|||From the results ...it looks globalvb_Visits has no indexes?
The scandensity looks fine.
That should be between the 75 and 100%.
"Russell" wrote:
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>|||I would also check out your OS disk file fragmentation. If default settings
for size and growth were used for the initial database, you will have
several hundred thousand 1MB fragments of your data file all over the disk.
I had a client with that problem and a simple defrag resulted in an 18%
throughput improvement!!
TheSQLGuru
President
Indicium Resources, Inc.
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not
> run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I
> presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> on
> the table but did not touch the first row. So what I want to know is A)
> What
> this first row represents and check that it should be as low as possible
> and
> B) what command will reduced it.
> Thanks in Advance Russell|||I will have a look at the disk fragmentation.
There are 4 indexes on the table and running DBCC DBRENINDEX against the
table reduces their logical fragmentation to 0%.
"TheSQLGuru" wrote:
> I would also check out your OS disk file fragmentation. If default settin
gs
> for size and growth were used for the initial database, you will have
> several hundred thousand 1MB fragments of your data file all over the disk
.
> I had a client with that problem and a simple defrag resulted in an 18%
> throughput improvement!!
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> "Russell" <Russell@.discussions.microsoft.com> wrote in message
> news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>
>|||Hi Russell
IndexID 0 indicates this table is a heap, which by definition has no
organization to it.
The purpose of DBCC INDEXDEFRAG is to make the physical order of pages in an
INDEX match the logical order, but since your table has no logical order,
DBCC INDEXDEFRAG will have no effect.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:9E83AC0A-1706-46A9-A525-DCD1B8E9B392@.microsoft.com...
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
tool database which currently stands at 440 GB and as a result have not run
the optimisation or integrity checking parts of the maintenance plan for a
long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
blank Indexname and also reports a 99.993% Logical Fragmentation. I presume
that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
(finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes on
the table but did not touch the first row. So what I want to know is A) What
this first row represents and check that it should be as low as possible and
B) what command will reduced it.
Thanks in Advance RussellThis is on a SQL Server 2000 SP3a server.
"Russell" wrote:
> I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not ru
n
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I presum
e
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes o
n
> the table but did not touch the first row. So what I want to know is A) Wh
at
> this first row represents and check that it should be as low as possible a
nd
> B) what command will reduced it.
> Thanks in Advance Russell|||The largest table with issue is globalvb_Visits and when I run DBCC
SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
output I get is listed below.
ObjectId
1382950102
IndexName
IndexId
0
Level
0
Pages
547631
Rows
27929035
MinimumRecordSize
149
MaximumRecordSize
149
AverageRecordSize
149
ForwardedRecords
0
Extents
68465
ExtentSwitches
68464
AverageFreeBytes
395.0390015
AveragePageDensity
95.11936188
ScanDensity
99.9839334
BestCount
68454
ActualCount
68465
LogicalFragmentation
99.99981689
ExtentFragmentation
27.22558975|||From the results ...it looks globalvb_Visits has no indexes?
The scandensity looks fine.
That should be between the 75 and 100%.
"Russell" wrote:
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>|||I would also check out your OS disk file fragmentation. If default settings
for size and growth were used for the initial database, you will have
several hundred thousand 1MB fragments of your data file all over the disk.
I had a client with that problem and a simple defrag resulted in an 18%
throughput improvement!!
TheSQLGuru
President
Indicium Resources, Inc.
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>I am having a look at the performance issues on a clients Website analysis
> tool database which currently stands at 440 GB and as a result have not
> run
> the optimisation or integrity checking parts of the maintenance plan for a
> long time. When I run DBCC SHOWCONTIG (finland_Visits) WITH FAST,
> TABLERESULTS, ALL_INDEXES, NO_INFOMSGS, one of the results returned has a
> blank Indexname and also reports a 99.993% Logical Fragmentation. I
> presume
> that this is what is hampering the query perfomance. I ran DBCC DBREINDEX
> (finland_Visits, '', 0) which reduced the fragmentation of the 4 indexes
> on
> the table but did not touch the first row. So what I want to know is A)
> What
> this first row represents and check that it should be as low as possible
> and
> B) what command will reduced it.
> Thanks in Advance Russell|||I will have a look at the disk fragmentation.
There are 4 indexes on the table and running DBCC DBRENINDEX against the
table reduces their logical fragmentation to 0%.
"TheSQLGuru" wrote:
> I would also check out your OS disk file fragmentation. If default settin
gs
> for size and growth were used for the initial database, you will have
> several hundred thousand 1MB fragments of your data file all over the disk
.
> I had a client with that problem and a simple defrag resulted in an 18%
> throughput improvement!!
> --
> TheSQLGuru
> President
> Indicium Resources, Inc.
> "Russell" <Russell@.discussions.microsoft.com> wrote in message
> news:697EE670-697D-4484-A105-9B1D3A9CDCEB@.microsoft.com...
>
>|||Hi Russell
IndexID 0 indicates this table is a heap, which by definition has no
organization to it.
The purpose of DBCC INDEXDEFRAG is to make the physical order of pages in an
INDEX match the logical order, but since your table has no logical order,
DBCC INDEXDEFRAG will have no effect.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://sqlblog.com
"Russell" <Russell@.discussions.microsoft.com> wrote in message
news:9E83AC0A-1706-46A9-A525-DCD1B8E9B392@.microsoft.com...
> The largest table with issue is globalvb_Visits and when I run DBCC
> SHOWCONTIG (globalvb_Visits) WITH FAST, TABLERESULTS, NO_INFOMSGS. The
> output I get is listed below.
> ObjectId
> 1382950102
> IndexName
> IndexId
> 0
> Level
> 0
> Pages
> 547631
> Rows
> 27929035
> MinimumRecordSize
> 149
> MaximumRecordSize
> 149
> AverageRecordSize
> 149
> ForwardedRecords
> 0
> Extents
> 68465
> ExtentSwitches
> 68464
> AverageFreeBytes
> 395.0390015
> AveragePageDensity
> 95.11936188
> ScanDensity
> 99.9839334
> BestCount
> 68454
> ActualCount
> 68465
> LogicalFragmentation
> 99.99981689
> ExtentFragmentation
> 27.22558975
>
Labels:
analysistool,
clients,
database,
fragmentation,
logical,
microsoft,
mysql,
oracle,
performance,
server,
sql,
stands,
website
Subscribe to:
Posts (Atom)