SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Database Table Slow
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pashatest
Starting Member

United Kingdom
3 Posts

Posted - 06/12/2013 :  10:11:36  Show Profile  Reply with Quote
I have two tables in the database: tb_CampaignLead and tb_Feed. Both tables have thousands of rows and have one index each on the primary key. tb_CampaignLead has 20% more data than tb_Feed. Still tb_Feed is 6 times slower than tb_CampaignLead for a SELECT *. Can anyone please tell me why is tb_Feed so slow. The tables structures are below

CREATE TABLE [dbo].[tb_Feed](
[FeedID] [uniqueidentifier] NOT NULL,
[DateCreated] [smalldatetime] NULL,
[LeadSourceID] [int] NULL,
[RawLeadURL] [nvarchar](max) NULL,
[CostPerEnquiry] [money] NULL,
[ResultText] [nvarchar](max) NULL,
[SrcResultText] [nvarchar](max) NULL,
[SrcResult] [bit] NULL,
[Encrypted] [bit] NULL,
[ProductID] [int] NULL,
CONSTRAINT [PK_tb_Feed] PRIMARY KEY CLUSTERED


CREATE TABLE [dbo].[tb_CampaignLead](
[LeadID] [uniqueidentifier] NOT NULL,
[FeedID] [uniqueidentifier] NOT NULL,
[CampaignID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[CompanyID] [int] NOT NULL,
[LeadSourceID] [int] NOT NULL,
[DateCreated] [smalldatetime] NULL,
[LeadTextEmail] [nvarchar](max) NULL,
[LeadTextOther] [nvarchar](max) NULL,
[DateSent] [smalldatetime] NULL,
[EmailResponse] [nvarchar](max) NULL,
[OtherResponse] [nvarchar](max) NULL,
[EmailOK] [bit] NULL,
[OtherOK] [bit] NULL,
[ResultPass] [bit] NULL,
[L_Title] [nvarchar](50) NULL,
[L_Email] [nvarchar](100) NULL,
[L_Firstname] [nvarchar](max) NULL,
[L_Surname] [nvarchar](max) NULL,
[L_Address1] [nvarchar](max) NULL,
[L_Address2] [nvarchar](max) NULL,
[L_Address3] [nvarchar](max) NULL,
[L_TownCity] [nvarchar](max) NULL,
[L_AreaRegion] [nvarchar](max) NULL,
[L_Country] [nvarchar](max) NULL,
[L_PostCode] [nvarchar](50) NULL,
[L_Telephone1] [nvarchar](50) NULL,
[L_Telephone2] [nvarchar](50) NULL,
[L_DOB] [smalldatetime] NULL,
[L_Extra1] [nvarchar](max) NULL,
[L_Extra2] [nvarchar](max) NULL,
[L_Extra3] [nvarchar](max) NULL,
[L_Extra4] [nvarchar](max) NULL,
[L_Extra5] [nvarchar](max) NULL,
[L_Extra6] [nvarchar](max) NULL,
[L_Extra7] [nvarchar](max) NULL,
[L_Extra8] [nvarchar](max) NULL,
[L_Extra9] [nvarchar](max) NULL,
[L_Extra10] [nvarchar](max) NULL,
[L_Extra11] [nvarchar](max) NULL,
[L_Extra12] [nvarchar](max) NULL,
[L_Extra13] [nvarchar](max) NULL,
[L_Extra14] [nvarchar](max) NULL,
[L_Extra15] [nvarchar](max) NULL,
[L_Extra16] [nvarchar](max) NULL,
[L_Extra17] [nvarchar](max) NULL,
[L_Extra18] [nvarchar](max) NULL,
[L_Extra19] [nvarchar](max) NULL,
[L_Extra20] [nvarchar](max) NULL,
[SourceCost] [money] NULL,
[CampaignCost] [money] NULL,
[DeliveredPass] [bit] NULL,
[FieldReqBWAND] [int] NULL,
[FieldSuppliedBWAND] [int] NULL,
[FilterBWAND] [int] NULL,
[FilterPassBWAND] [int] NULL,
[OPFilterBWAND] [int] NULL,
[OPFilterPassBWAND] [int] NULL,
[ProcessBWAND] [int] NULL,
[ProcessPassBWAND] [int] NULL,
[L_MobileNetwork] [nvarchar](max) NULL,
[SrcResultPass] [bit] NULL,
CONSTRAINT [PK_tb_CampaignLead] PRIMARY KEY CLUSTERED

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 06/12/2013 :  10:19:04  Show Profile  Reply with Quote
is it just a SELECT * or do you've some filter conditions as well using WHERE?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

pashatest
Starting Member

United Kingdom
3 Posts

Posted - 06/12/2013 :  10:49:01  Show Profile  Reply with Quote
Just a SELECT * with no where conditions. Basically for any transaction for tb_feed seems to be much slower than tb_campaignlead.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 06/12/2013 :  11:43:35  Show Profile  Reply with Quote
what doesn execution plan sugest?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

pashatest
Starting Member

United Kingdom
3 Posts

Posted - 06/12/2013 :  15:42:22  Show Profile  Reply with Quote
It just says a select of the clustered index scan (the primarykey)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52323 Posts

Posted - 06/13/2013 :  00:49:01  Show Profile  Reply with Quote
is there any other steps that have high cost?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 06/14/2013 :  00:10:49  Show Profile  Reply with Quote
This is just a guess but I'd say it's likely to be the amount of data you are returning rather than the number of rows.

RawLeadURL] [nvarchar](max) NULL,
[ResultText] [nvarchar](max) NULL,
[SrcResultText] [nvarchar](max) NULL,

These guys can store a ton of data, all of which has to be scooped up and sent across the network. Furthermore, depending on how big they are, they could be stored off-table necessitating more IO when they are retrieved.
Go to Top of Page

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1054 Posts

Posted - 06/20/2013 :  14:29:05  Show Profile  Reply with Quote
"only select without a where condition", scan would be always going to perform by the SQL server.

Perhaps you might want to check the fregmentation and defregment it if required?

Cheers
MIK
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000