473,466 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is it normal for a query on a 90k record table to take 1+ seconds?

I have a table that is --
30 Megabytes
90,000 rows
~65 columns

My query goes

SELECT city FROM table WHERE zip = 90210;

It will then find about 10 matching records.

I have an index on both zip and city.

This query takes on average anywhere from 0.80 seconds to 2.5 seconds.
Is this normal speed? I've been breaking my back trying to get it in
the sub 0.1 second range.

Thanks!
-Matt

Nov 23 '05 #1
5 1412
You should put an index an the zip column. That's all you can (and should)
do from the query optimizing point of view.

Markus
Nov 23 '05 #2
Mark I already have two separate indexes in place, one on zip, one on
city.

Is the physical size of the table slowing down the query?

Is it the 90k records, or the 65 columns?

Nov 23 '05 #3
For this particular query, only the index on the zip column will help you
(that doesn't mean, that the index on the city column can't help for other
queries - this only applied to this one particular query). As a general
rule, you should also take care not to place indexes that are not necessary,
because they can slow down INSERTs. Indexes should always be balanced
according to the concrete needs of a table. A good choice is to place
indexes on columns that have direct relations to other tables or that are
often used in a WHERE clause (like the zip column in your query).

65 columns for a table are quite a lot - are you sure that the data is
properly normalized (in case it is not, normalization would very likely lead
to better performence).

Also if it is normalized (although it's very rare that you need 65 columns
in a table if the data is normalized), it could make sense to split it up to
create 2 or more tables that are referenced to each other in a 1 : 1
relationship. You could group the data together in a way that you have those
columns in the same table that are mostly queried together. The less columns
you have, the better the performence will be.

The 90,000 rows should not be the problem because if you have that amount of
data to store, there's probably no way to reduce the number of rows. The
solution will most likely be to split the data up into more tables.

Markus
Nov 23 '05 #4
Markus,

Thank you for the very imformative reply. It makes complete sense.

I started splitting the table up per your suggestion and got immediate
results!

It's not my system, I'm just doing some contract work, so hopefully the
maintainers will be able to make some permanent normalization updates.

Thanks again,
-Matt

Nov 23 '05 #5
On 14/11/2005, MattPF wrote:
SELECT city FROM table WHERE zip = 90210;

It will then find about 10 matching records.

I have an index on both zip and city.


A covering composite index on (zip, city) may help here.

ALTER TABLE table ADD INDEX (zip, city);

--
felix
Nov 23 '05 #6

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

Similar topics

1
by: Ben Binskin | last post by:
hi Im just curious, im developing a web site for a client the content of which is vehicles the database has a number of different methods to search by, but as soon as you get to a singular vehicle...
8
by: DraguVaso | last post by:
Hi, I'm new to WebServices, and I'm doing some tests (with a small VB.NET-application) to know the performance-difference between a WebService and the 'normal'-way of getting data (just...
15
by: Rolan | last post by:
There must be a way to enhance the performance of a query, or find a plausible workaround, but I seem to be hitting a wall. I have tried a few tweaks, however, there has been no improvement. ...
6
by: gerbski | last post by:
Hi all, I am relatively new to ADO, but up to now I got things working the way I wanted. But now I've run into somethng really annoying. I am working in MS Access. I am using an Access...
2
by: Himmel | last post by:
Hello! The reference database I currently use runs queries that pull data from hundreds of tables in order to create user-friendly form view. The problem is that these queries can take upwards of...
1
by: Andy_Khosravi | last post by:
Background: Access 2003 (converted from A97 DB recently), database is split into FE/BE with the FE residing on client machine. I've got a question about how I can possibly optimize a query I've...
13
by: Neil | last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been running for 20 minutes so far! The query is quite simple: update a single field in a table, based on a join with another...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.