473,511 Members | 15,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which query would be faster

Which would be faster a single

select * from table where part in (A12345,1FB2356,346C79,349872)

or multiple

select * from table where part="A12345"
select * from table where part="1FB2356"
select * from table where part="346C79"
select * from table where part="349872"
Table has 450,000 rows
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| part | char(10) | YES | MUL | NULL | |
| descr | char(9) | YES | | NULL | |
| list | decimal(7,2) | YES | | NULL | |
| trade | decimal(7,2) | YES | | NULL | |
| cost | decimal(7,2) | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+


Jul 19 '05 #1
2 1631
I would have guessed on the first one.
My expericence say that one query is faster than many. *

* depends on the querystructure.

Christoph Schmitz
"Bob Van Der Ploeg" <bo*@vdpcorp.com> wrote in message news:<es********************@twister.tampabay.rr.c om>...
Which would be faster a single

select * from table where part in (A12345,1FB2356,346C79,349872)

or multiple

select * from table where part="A12345"
select * from table where part="1FB2356"
select * from table where part="346C79"
select * from table where part="349872"
Table has 450,000 rows
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| part | char(10) | YES | MUL | NULL | |
| descr | char(9) | YES | | NULL | |
| list | decimal(7,2) | YES | | NULL | |
| trade | decimal(7,2) | YES | | NULL | |
| cost | decimal(7,2) | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+

Jul 19 '05 #2
I would have guessed on the first one.
My expericence say that one query is faster than many. *

* depends on the querystructure.

Christoph Schmitz
"Bob Van Der Ploeg" <bo*@vdpcorp.com> wrote in message news:<es********************@twister.tampabay.rr.c om>...
Which would be faster a single

select * from table where part in (A12345,1FB2356,346C79,349872)

or multiple

select * from table where part="A12345"
select * from table where part="1FB2356"
select * from table where part="346C79"
select * from table where part="349872"
Table has 450,000 rows
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| part | char(10) | YES | MUL | NULL | |
| descr | char(9) | YES | | NULL | |
| list | decimal(7,2) | YES | | NULL | |
| trade | decimal(7,2) | YES | | NULL | |
| cost | decimal(7,2) | YES | | NULL | |
+-------+--------------+------+-----+---------+-------+

Jul 19 '05 #3

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

Similar topics

9
3109
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
1
4270
by: Paul | last post by:
Assume you have two varchar (or Text) columns named L and U which are identical except that the charset for L is latin1 and the charset for U is utf8. All the records in L and U are identical in...
2
3460
by: ruben | last post by:
Hi: I must have missed something, but how is it possible that a join on tables A and B is faster (a lot faster) than a query to one of the tables with the same conditions? The problem seems...
11
2117
by: 73blazer | last post by:
We are migrating a customer from Version 7.1 FP3, to Version 8.2 (8.1 FP8). For the most part, things are faster, but there is one query that is much much slower, and it is a query that is used all...
1
2425
by: Danny Dy | last post by:
Hi To All, I always write My VBA code in SQL(see Example). Private Sub cbxAEName_NotInList(NewData As String, Response As Integer) Dim stSQL as String Dim strMsg As String strMsg = "'" &...
3
2047
by: mathilda | last post by:
When I'm opening a recordset for add new, is it faster to put a limiting clause on it? i.e. does "Select from Where Keyfield = " & value & " return a recordset faster than "Select ...
2
2163
by: thomson | last post by:
Hi all, can any one tell me which is fast traversing a XML file or a hash file is fast, i got few few field names and values in XML which i will use to retrieve. I can use Hash File also to do the...
2
2613
theGeek
by: theGeek | last post by:
I always wonder which one of join or subquery should I be using to solve a particuar problem so that I get the correct result set in minimum time. It usually happens that I can write a query quickly...
10
3132
by: Ian | last post by:
Henry J. wrote: MDC *guarantees* clustering, whereas a table with a clustering index will eventually require maintenance (a.k.a. reorg) to maintain the cluster ratio. That's not to say that...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
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
7075
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
5662
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,...
1
5063
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
4737
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
3222
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
1572
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 ...
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.