473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

select top 100 query very slow one table

Here is the table in question.
Number of records 5512825
not a big table and plenty of good indexs i think? that is the big
questions.
Could some one help?
After the table creation and index you will see a query that takes
almost 2.3 minutes to run this is totally bad. That time is through
the query analyzer.
Any help here would be greatly apperciated.
CREATE TABLE [dbo].[tblpolmaster] (
[IDX] [int] IDENTITY (1, 1) NOT NULL ,
[AG_NO] [int] NOT NULL ,
[PR_NO] [int] NOT NULL ,
[PLAN_NO] [char] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[SUB_PLAN_NOS] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
,
[FIN_NO] [int] NOT NULL ,
[ACCT_NO] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[DRAFT_NO] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_LNAME] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_FNAME] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_MI] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_ADDRESS] [char] (35) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_CITY] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_STATE] [char] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_ZIP] [char] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_PLUS4] [char] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_PHONE] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_FAX] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_MEMBER] [char] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[POL_NUM] [char] (22) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[USER_ID] [char] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PR_COUNT] [int] NOT NULL ,
[TRANS_DT] [smalldatetime] NULL ,
[PR_CERT] [int] NOT NULL ,
[EDIT_DT] [smalldatetime] NULL ,
[POL_NUM_MEMBER] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL
) ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPLAN_NO] ON
[dbo].[tblpolmaster]([PLAN_NO]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_NAME] ON
[dbo].[tblpolmaster]([POL_LNAME], [POL_FNAME]) WITH FILLFACTOR = 90
ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_STATE] ON
[dbo].[tblpolmaster]([POL_STATE]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_NUM] ON
[dbo].[tblpolmaster]([POL_NUM]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterAG_NO] ON [dbo].[tblpolmaster]([AG_NO])
WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPR_NO] ON [dbo].[tblpolmaster]([PR_NO])
WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_ADDRESS] ON
[dbo].[tblpolmaster]([POL_ADDRESS]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_PHONE] ON
[dbo].[tblpolmaster]([POL_PHONE]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPR_COUNT] ON
[dbo].[tblpolmaster]([PR_COUNT]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterFIN_NO] ON
[dbo].[tblpolmaster]([FIN_NO]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterUSER_ID] ON
[dbo].[tblpolmaster]([USER_ID]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterTRANS_DT] ON
[dbo].[tblpolmaster]([TRANS_DT]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_MEMBER] ON
[dbo].[tblpolmaster]([POL_MEMBER]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterDRAFT_NO] ON
[dbo].[tblpolmaster]([DRAFT_NO]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterEdited] ON
[dbo].[tblpolmaster]([EDIT_DT]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_NUM_MEMBER] ON
[dbo].[tblpolmaster]([POL_NUM_MEMBER]) WITH FILLFACTOR = 90 ON
[PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_FNAME] ON
[dbo].[tblpolmaster]([POL_FNAME]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_LNAME] ON
[dbo].[tblpolmaster]([POL_LNAME]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_tblpolmasterPOL_CITY] ON
[dbo].[tblpolmaster]([POL_CITY]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

Select Top 100 tblpolmaster.Idx,
tblpolmaster.Ag_No, tblpolmaster.Pr_No, tblpolmaster.Pol_LName,
tblpolmaster.Pol_FName,
tblpolmaster.pol_Address, tblpolmaster.Pol_City,
tblpolmaster.Pol_State, tblpolmaster.POL_MEMBER, tblpolmaster.Pr_Count
FROM tblpolmaster WITH (NOLOCK)
Where
tblpolmaster.PR_NO = 514
And tblpolmaster.POL_STATE = 'FL'
Jul 20 '05 #1
0 9629

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: lkrubner | last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR, INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql? PostGre info would also be useful. I'm trying to...
2
by: Benoit Le Goff | last post by:
Hello. I test some query on sql server 2000 (sp2 on OS windows 2000) and i want to know why a simple query like this : select * from Table Where Column like '%value' is more slow on 2000 than...
5
by: eddie wang | last post by:
hello, I have the following query. it returns result in less than 1 second. select * from employee e, address a where e.id=a.emp_id and e.id=1234 The problem is that it becomes extremely slow...
1
by: David Lawson | last post by:
The line indicated below from my php script is very slow (about 10 seconds). I have this field indexed so I thought that it would be much faster. Could someone tell me what might be wrong? I'm also...
2
by: boonkit | last post by:
I run a query on a 3 million rows table (avrg row length 2988) as below: SELECT COUNT(*) FROM tbl WHERE MATCH (col) AGAINST ('keyword'); The query above took from 5 - 10 seconds. Below is...
6
by: RCS | last post by:
I've been running into more and more complexity with an application, because as time goes on - we need more and more high-level, rolled-up information. And so I've created views, and views that use...
4
by: psql-mail | last post by:
I am running a SELECT to get all tuples within a given date range. This query is much slwoer than i expected - am i missing something? I have a table 'meta' with a column 'in_date' of type...
4
by: Nicolae Fieraru | last post by:
Hi All, I have a Table1 with ID, Name, Address, Purchase. I want to build a query which shows all the records from Table1 (only fields ID, Name, Address), but there shouldn't be listed records...
2
by: Pavel Stehule | last post by:
Hello, Pg make query 1. and 2. very fast (use index), but for query 3. dont use index. I can solve its using select union, but I readed so pg 7.5 don't problem with OR operator. I use cvs pg. I...
5
by: parwal.sandeep | last post by:
Hello grp! i'm using INNODB tables which are using frequently . if i fire a SELECT query which fetch major part of table it usually take 10-20 seconds to complete. in mean time if any UPDATE...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.