Subject | Locate |
---|---|
Author | Thomas Besand |
Post date | 2005-05-27T10:20:10Z |
Hello ng,
in the application I'm working on right now, I want to walk through a
table of adresses and look each one up in another table (based on a
selection of 3-5 fields) to find duplicate values. Tables can have
roughly a million records.
I recall to have read that the Locate method built into Delphi data
components does not make use of any index that might be available in the DB.
Can someone confirm this? And if it is so, what would be the method of
choice to accomplish a Locate function.
I'm thinking about implementing it all in SQL, like:
SELECT ID FROM SomeTable WHERE Field1='Value1' AND Fields2='Value2'
AND Field3='Value3'
If this query returns at least one record use the ID to update the
record in question
'UPDATE SomeTable SET Field1='NewValue1', Field2='NewValue2',
Field3='NewValue3' WHERE ID=' + ifoundID
Would that be a better path to follow, especially concerning performance?
Thanks for your input.
And have a nice weekend (here in Berlin, Germany it's just starting:
Friday afternoon!)
Greets
Thomas Besand
in the application I'm working on right now, I want to walk through a
table of adresses and look each one up in another table (based on a
selection of 3-5 fields) to find duplicate values. Tables can have
roughly a million records.
I recall to have read that the Locate method built into Delphi data
components does not make use of any index that might be available in the DB.
Can someone confirm this? And if it is so, what would be the method of
choice to accomplish a Locate function.
I'm thinking about implementing it all in SQL, like:
SELECT ID FROM SomeTable WHERE Field1='Value1' AND Fields2='Value2'
AND Field3='Value3'
If this query returns at least one record use the ID to update the
record in question
'UPDATE SomeTable SET Field1='NewValue1', Field2='NewValue2',
Field3='NewValue3' WHERE ID=' + ifoundID
Would that be a better path to follow, especially concerning performance?
Thanks for your input.
And have a nice weekend (here in Berlin, Germany it's just starting:
Friday afternoon!)
Greets
Thomas Besand