ginsonic
asked on
FireBird speed
I have a program that use a FireBird database. All work perfect when navigate, but when insert new records I must spend to much time.
For just 30 records with 15 fields I must wait 30-40 sec. Is normal ? In BDE is instantly.
For just 30 records with 15 fields I must wait 30-40 sec. Is normal ? In BDE is instantly.
ASKER
I use for select:
SELECT * FROM MyDB ORDER BY DATE DESC
Maybe because is ordered I send so much time?
SELECT * FROM MyDB ORDER BY DATE DESC
Maybe because is ordered I send so much time?
your question is about INSERT performance. Is this SELECT statement part of the INSERT SQL?
* Yes. Performance WILL be slower with an Order By clause.
* Since you can Order By when you retrieve the rows, inserting them this way doesn't make sense.
* if there isn't an index on the DATE column in the MyDB table, this process WILL be slower
* Yes. Performance WILL be slower with an Order By clause.
* Since you can Order By when you retrieve the rows, inserting them this way doesn't make sense.
* if there isn't an index on the DATE column in the MyDB table, this process WILL be slower
ASKER
insert sql:
insert into "MyDB"
(VAR1, ... VAR 31)
values
(:VAR1, ... :VAR31)
I don't have any index on by gdb . I use ORDER just for SELECT sql.
insert into "MyDB"
(VAR1, ... VAR 31)
values
(:VAR1, ... :VAR31)
I don't have any index on by gdb . I use ORDER just for SELECT sql.
For the time being, forget the SELECT statement. It isn't relevant to this INSERT problem.
Did you read the text at the link I posted? They've got some good suggestions. One which may help the most is to start a transaction before you begin inserting records. Once the records have been added, comit the transaction. What you are doing now is causing a comit after every INSERT statement.
Aside from suppressing index updating until you have finished inserting, you might be experiencing delays caused by triggers. There isn't much you can do about them, but you might improve their performance (code tuning and database/table/index tuning).
Did you read the text at the link I posted? They've got some good suggestions. One which may help the most is to start a transaction before you begin inserting records. Once the records have been added, comit the transaction. What you are doing now is causing a comit after every INSERT statement.
Aside from suppressing index updating until you have finished inserting, you might be experiencing delays caused by triggers. There isn't much you can do about them, but you might improve their performance (code tuning and database/table/index tuning).
ASKER
Can you teach me more?
I use FIBPlus library to access and I have assigned a transaction to my FibDatabase. Is opened all the time.
I use FIBPlus library to access and I have assigned a transaction to my FibDatabase. Is opened all the time.
<<Is opened all the time>>
That might be a problem. Database transactions are meant to be started and either commited or rolledback.
I don't use the Devrace components and don't have a great deal of Firebird experience. Most of my recommendations in this post are from my general relational database experience (two decade's long) and relevant web articles about Firebird Insert performance. My mentoring ability is limited in this instance.
That might be a problem. Database transactions are meant to be started and either commited or rolledback.
I don't use the Devrace components and don't have a great deal of Firebird experience. Most of my recommendations in this post are from my general relational database experience (two decade's long) and relevant web articles about Firebird Insert performance. My mentoring ability is limited in this instance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry for delay, was gone for a time. I will test and come back.
Thanks for suport!
Thanks for suport!
2. What indexes are defined on these 15 columns?
3. Does this performance degrade over time or are all inserts slow?
4. How fragmented is the hard drive?
==========================
From http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_tip_perf:
"To minimize the performance hit during INSERT, consider temporarily disabling indices during high-volume INSERTs. This will "turn off" the indices, making them unavailable to help speed up queries, but also making them not be updated by data INSERTs. Then re-enable the indices after INSERTing data. This will update and rebalance the indices once for all the inserted data."
NOTE: There are also some other good tips on that page.