![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
![]() |
Wed, Jun 3 2009 9:47 AM | Permanent Link |
"Mauro Botta" | Hi
I have a table with much fields ( 200-300 ) i need open this table , seek on record and result a field. i need this in FAST MODE ![]() My generic code now : table.Create table.Open <- SLOW table.GotoKey Result := table.FieldByaname('NameField_1').AsString table.Close table.Free but it e' too slow. Is there a optimized command for read only one field value from a big table ? ( big table = much fields , i have only 100-200 records ) i should edb don't read all 200 fields structure, in open i need only NameField_1 when Open is occured. i have try with TEdbTable at RunTime , with FieldDef defined ( only one field in list : NameField_1 ) don't work , EDB read always all 200 fields ( it is slow to open table ) Hint ? Delphi 2009 + EDB 2.0 B10 , NO C/S |
Wed, Jun 3 2009 10:34 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Mauro
From your other post you had a table with 2 columns taking a long time to open now you have one with 200 fields and you're blaming the number of columns. You haven't said how slow it is, wether its being used in a loop or what. I'd recommend trying sql for something like this. A simple SELECT statement will work in pseudo code create query query.sql.text = 'SELECT NameField_1 FROM table WHERE selection criteria' query.open Result := query.FieldByaname('NameField_1').AsString query.Close query.Free If its a one off that's about as fast as you'll get as long as you make sure you have appropriate indices on the selection criteria. If its in a loop or multiple times then initialise the query create query query.sql.text = 'SELECT NameField_1 FROM table WHERE selection criteria' query.prepare and leave it available use the query query.close query.parambyname(xx).aswhatever := selection Result := query.FieldByaname('NameField_1').AsString finally get rid when no longer wanted (eg in FormClose) query.Close query.unprepare query.Free Roy Lambert [Team Elevate] |
Wed, Jun 3 2009 3:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Mauro,
<< I have a table with much fields ( 200-300 ) i need open this table , seek on record and result a field. i need this in FAST MODE ![]() The fastest way would be to use a TEDBQuery component instead, like Roy indicated. Using a TEDBTable will result in all of the columns being loaded into TFieldDefs, at the very least, with TFields being created for all of them in the default case. You can use just one persistent TField by double-clicking on the TEDBTable and just adding the one desired field to the list of persistent fields, and that will cut down on the time a bit, but the query will always be the fastest method. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |