473,387 Members | 1,476 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,387 software developers and data experts.

Faster search

1
HELP....

I am trying to read a table that has 598,865 records. The problem is when I try to access it by year. When I use the following query it is fast :
Expand|Select|Wrap|Line Numbers
  1. SELECT table_data.name, table_data.amount
  2. FROM table_data
  3. WHERE yr = 2009
But when I use the following subquery it is slower :
Expand|Select|Wrap|Line Numbers
  1. SELECT table_data.name, table_data.amount
  2. FROM table_data
  3. WHERE yr = (select yr_today from parameter_table)
NOTE : parameter_table is a table with 1 record and 2 fields : yr_today(number, in this case 2009) and yr_prev(number, in this case 2008).

Can anyone help me with the second query so it can be faster, because I don't like to hard code data in the queries.
Jan 5 '09 #1
2 1398
FishVal
2,653 Expert 2GB
Hello, Oreber.

Try to use join instead of subquery:
Expand|Select|Wrap|Line Numbers
  1. SELECT table_data.name, table_data.amount
  2. FROM table_data INNER JOIN parameter_table
  3.   ON table_data.yr=parameter_table.yr_today;
Just out of curiosity - what is this table combination supposed to do?

Regards,
Fish.
Jan 5 '09 #2
NeoPa
32,556 Expert Mod 16PB
In general, Access "gives up" trying to be clever with SQL as soon as it hits a sub-query.

Fish's INNER JOIN solution should sort you out though :)

Welcome to Bytes!
Jan 6 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Kamilche | last post by:
I was looking for a way to speed up detecting invalid characters in my TCP string, and thought of yet another use for the translate function! If you were to 'translate out' the bad characters, and...
3
by: Savas Ates | last post by:
im using xmlhttp to get info from 10 different sites.. 1 site's info is coming to me about 3 second. but when i use 10 sites it longs about 30 seconds.. how can i make it faster ... any solution or...
7
by: Danny | last post by:
I am trying to process a database and my code does so much that it takes a whle to go through the database. most of it is sql queries, updates and such. For about 6000 records, it takes over a...
25
by: Justin Robbs | last post by:
I need to fill a number of character fields with spaces or zero's depending on the field. Which method is faster. char var = " "; var = '\0'; or char var; sprintf( var, " ...
2
by: kids_pro | last post by:
Hi there, When class construct it read content from XML file and store it in ArrayList. In my class I had implement Search method using BinarySearch behind. I want to implement another Method...
6
by: Steven Wolf | last post by:
Hi guys, can a hashtable be faster than a sql server?? i made my own O/R mapping with an "entity cache" (caching all mapped objects). So, when i get some data from my sql server, i map that data...
10
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All...
5
by: Sonnich | last post by:
Hi all I use the opendir and readdir to search for files... but they read in all files, so sometimes I get several hundreds. If there is a way to give a wildcard, it might be a lot faster....
16
by: Jon Davis | last post by:
We ordered new systems with fast hardware and great specs, but Visual Studio takes longer to build a project than on the old workstation. Msbuild is faster, csc.exe is faster, file copy is faster....
5
by: buu | last post by:
I have an function that replaces some string from a huge text that I run very often... So, I wanted to speed it up... I was using String and StringBuilder. But, I was wandering should same...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.