Subject | Re: [IBO] Locating |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-08-07T08:26:14Z |
Welcome Ryan!
records?" Sure, sometimes that may be necessary, like when doing reports or
printing things for handling by different persons, but since you have a BDE
background I suspect you to retrieve records you are not really interested
in. Rule of thumb: Only retrieve 2000 records if you need to do some work
with all of them and that work cannot be done on the server.
slow line or use long fields.
SELECT <requiredcolumns>
FROM <atable>
WHERE <afield> = :<parametername>
Then I prepare the TIB_Query (or TIB_Cursor), set the parameter and open.
Whenever the record of interest changes, close the TIB_Query, change the
parameter value and reopen.
Another option if it is done online, is to use search mode.
particular order in the database itself. To speed up a call to the "last"
record ("last" being relative to your order by clause), create a DESC index.
HTH,
Set
>Coming from a BDE background, I think I'm still having someYou're probably right, but being aware of it is a great start!
>conceptual issues.
>I have a table with 2000 records.Well, my first question would be: "Why do you need to retrieve 2000
>When I do a T_IBQuery.Locate, locating the last record in the table,
>it seems to take some time, as it "Fetches" all records.
records?" Sure, sometimes that may be necessary, like when doing reports or
printing things for handling by different persons, but since you have a BDE
background I suspect you to retrieve records you are not really interested
in. Rule of thumb: Only retrieve 2000 records if you need to do some work
with all of them and that work cannot be done on the server.
>A dialog pops up with,8 seconds for 2000 rows? Sounds pretty slow, but maybe you are using some
>"Fetching Query Results"
>(taking around 8 secs)
>until the last record is reached.
slow line or use long fields.
>What am I not understanding? Do I close the query, make the WHEREYou could do, what I normally do is write something like
>clause reflect the record I want then re-open it?
SELECT <requiredcolumns>
FROM <atable>
WHERE <afield> = :<parametername>
Then I prepare the TIB_Query (or TIB_Cursor), set the parameter and open.
Whenever the record of interest changes, close the TIB_Query, change the
parameter value and reopen.
Another option if it is done online, is to use search mode.
>I guess I just don't understand why all records are fetched whenSimply because indexes are unidirectional and nothing is stored in any
>doing a locate.
particular order in the database itself. To speed up a call to the "last"
record ("last" being relative to your order by clause), create a DESC index.
HTH,
Set