|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
Here is a question that I have been thinking about and maybe someone out there can help me out.
Is it faster to loop through a query looking for a specific value or to send new queries asking for only the specific value. Code:
Array as some array
submit SQL in query object
do until end of Array{
do until query = Array{
move to next query
}
move to next Array
do something with query
}
OR Code:
Array as some array
do until end of Array{
SQL = Array
submit SQL in query object
move to next Array
do something with query
}
Thanks Eric |
|
#2
|
||||
|
||||
|
>Is it faster to loop through a query looking for a specific value or to send new queries asking for only the specific value.
This, along with your pseudo code, doesn't make whole lot of sense. Could you explain in plain english what you want?
__________________
And you know I mean that. |
|
#3
|
|||
|
|||
|
Usually, less DB access is better
DB Access is generally one of the slowest part of an app. A frequently successful strategy is to cache a large query with many records and use app code to retrieve desired specific records from that query. Of course, if your recordset is potentially huge (many megabytes) then you might have memory issues.
In general, I would say it is faster to loop through a large query looking for the values you want than to execute many small queries. Of course, be careful that you don't end up looping through 20000 records. Hope this helps! |
|
#4
|
||||
|
||||
|
Thanks,
That's what I thought. I just wanted to make sure. Eric |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Logic Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|