General Database Question
I have a general database question which is puzzling me. Lets say i have a table with about 50,000 records. The table has about 20 fields and i want to do a query. Which would be faster: If i query 2 fields or if i refine my search and include 3 fields?
[257 byte] By [
gumball187] at [2007-11-18 18:39:23]

# 1 Re: General Database Question
Depends on the DB, the index structure and other issues. Your question is WAY to general to be answerable.
# 3 Re: General Database Question
That is potentially correct.
On certain databases the query will look to see if there is an index that matches the targeted fields and use it.
Assuming there is a compound index on the two fields, but not one on the three fields, the database MAY "decide" to do a linear search.
Note, these are only possibilities, *MOST* database do not exhibit this quality.
# 4 Re: General Database Question
wel the problem i'm having is that when i query with 2 fields, it comes up just fine (brings up about 200 records)... but when i query with 3 field its locks up the whole system (should bring up about 190 fields). This is a shelf dbase so i'm kind of limited to what i can see and change refering to the structure and back-end. I just wanna build a case so i can go back to the developers and yell at them... :D