Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fetching records in interbase or Firebird produce crashes

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I have one problem working on Firebird (Fre version of Interbase).
When I have a table or a query with many many records, for example 300000 records, when I am in the first record, and I want to go directly to the last record, I have a big problem.

The problem is that i must use the command
QR.RecNo=300000;
or the command
QR.Last;

This commands fetches all the records in the database from the actual record to the record that you want to access, and when you have 300000 records or more, the program takes some time (very long), or the program is crashed.

How can I avoid that??????

Thank you very much in advance!!!
 
The fact that you have 300,000 records in a database and want to go to the last one - will cause long delays. Interbase is a client-server database and so fetches records on demand.

A better policy may be to use some criteria, so it only has to return a sub-set of records. If you are using a number as a key field - you could use a select statement that effectively says "Where RecordID >= ThisNumber".

Just a thought.

 
There's no such thingy as a "last record". No matter how many records you have in your database, you always work with result-sets. That's why the component is called Query. You "ask" the server for a certain amount of data. The server then readies this data for you and puts it in a list. When someone updates a piece of this data, you will not see this unless you re-query... When you're fetching the last record in this result-set, you have already fetched all other records.

If you only want to see a couple of records, just ask for a couple of records. You can specify certain filtering criteria, like WHERE LAST_NAME LIKE 'T%' -- the server then readies only the records that meet the criteria.


Hope this helps,
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top