![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have two tables in SQL 6.5 database with identical fields and indexes. One contains the data of August 2003 and other July 2003. Now the august table is larger ( about 40000 more rows ) than the july table but i've noticed that the same queries perform much faster on the august table than the july table. Ive tried this with many different queries so i'm wondering whats the reason behind this. Is there a way to optimize a table? Remember , I'm using SQL 6.5 |
#3
| |||
| |||
|
|
MAB (IVZXKLCJFSFLSDFA (AT) yahoo (DOT) com) writes: I have two tables in SQL 6.5 database with identical fields and indexes. One contains the data of August 2003 and other July 2003. Now the august table is larger ( about 40000 more rows ) than the july table but i've noticed that the same queries perform much faster on the august table than the july table. Ive tried this with many different queries so i'm wondering whats the reason behind this. Is there a way to optimize a table? Remember , I'm using SQL 6.5 Without seeing the CREATE TABLE and CREATE INDEX statemetns for the tables it is difficult to tell. But one possibilty is that the July table suffers more from fragmentation. DBCC SHOWCONTIG can give some information. With DBCC DBREINDEX you can rebuild the indexes to reduce fragmentation. |
#4
| |||
| |||
|
|
Erland Sommarskog <sommar (AT) algonet (DOT) se> wrote in message news:Xns93EC5C285609EYazorman (AT) 127 (DOT) 0.0.1... MAB (IVZXKLCJFSFLSDFA (AT) yahoo (DOT) com) writes: I have two tables in SQL 6.5 database with identical fields and indexes. One contains the data of August 2003 and other July 2003. Now the august table is larger ( about 40000 more rows ) than the july table but i've noticed that the same queries perform much faster on the august table than the july table. Ive tried this with many different queries so i'm wondering whats the reason behind this. Is there a way to optimize a table? Remember , I'm using SQL 6.5 Without seeing the CREATE TABLE and CREATE INDEX statemetns for the tables it is difficult to tell. But one possibilty is that the July table suffers more from fragmentation. DBCC SHOWCONTIG can give some information. With DBCC DBREINDEX you can rebuild the indexes to reduce fragmentation. CREATE TABLE dbo.Aug2003Calls ( NASIdentifier varchar (16) NOT NULL , NASPort int NOT NULL , AcctSessionID varchar (10) NOT NULL , AcctStatusType tinyint NOT NULL , CallDate smalldatetime NOT NULL , UserName varchar (32) NOT NULL , UserService tinyint NULL , AcctDelayTime int NULL , AcctSessionTime int NULL , FramedProtocol int NULL , FramedAddress varchar (16) NULL , AcctInputOctets int NULL , AcctOutputOctets int NULL , AcctTerminateCause tinyint NULL , NASPortType tinyint NULL , NASPortDNIS varchar (10) NULL , CallerId varchar (16) NULL , FramedCompression int NULL , FramedNetmask int NULL , ModemSlotNo int NULL , ModemPortNo int NULL , XmitRate int NULL , AscendDataRate int NULL , AscendDisconnectCause int NULL , AscendConnectProgress int NULL , AcctLinkCount int NULL , AscendModemShelfNo int NULL ) GO CREATE INDEX idxAug2003Calls ON dbo.Aug2003Calls(CallDate, UserName) GO CREATE TABLE dbo.Jul2003Calls ( NASIdentifier varchar (16) NOT NULL , NASPort int NOT NULL , AcctSessionID varchar (10) NOT NULL , AcctStatusType tinyint NOT NULL , CallDate smalldatetime NOT NULL , UserName varchar (32) NOT NULL , UserService tinyint NULL , AcctDelayTime int NULL , AcctSessionTime int NULL , FramedProtocol int NULL , FramedAddress varchar (16) NULL , AcctInputOctets int NULL , AcctOutputOctets int NULL , AcctTerminateCause tinyint NULL , NASPortType tinyint NULL , NASPortDNIS varchar (10) NULL , CallerId varchar (16) NULL , FramedCompression int NULL , FramedNetmask int NULL , ModemSlotNo int NULL , ModemPortNo int NULL , XmitRate int NULL , AscendDataRate int NULL , AscendDisconnectCause int NULL , AscendConnectProgress int NULL , AcctLinkCount int NULL , AscendModemShelfNo int NULL ) GO CREATE INDEX idxJul2003Calls ON dbo.Jul2003Calls(CallDate, UserName) GO |
#5
| |||
| |||
|
|
CREATE TABLE dbo.Aug2003Calls ( ... ) GO CREATE INDEX idxAug2003Calls ON dbo.Aug2003Calls(CallDate, UserName) GO CREATE TABLE dbo.Jul2003Calls ( ... GO CREATE INDEX idxJul2003Calls ON dbo.Jul2003Calls(CallDate, UserName) GO |
![]() |
| Thread Tools | |
| Display Modes | |
| |