|
INTERVIEW QUESTIONS
DATABASE
FIREBIRD
DETAILS
Question: Is there some bulk load or other way to import a lot of data fast?
Answer: Currently there is only one way to quickly load a lot of data into database. That is by using external tables. You should read the manual for details, but here's a short explanation. You create a binary or textual file using the external table format and then hook it up in the database using a statement like this:
CREATE TABLE ext1 EXTERNAL 'c:myfile.txt' ( field1 char(20), field2 smallint );
To do quick import into regular table, do something like this:
INSERT INTO realtable1 (field1, field2) SELECT field1, field2 FROM ext1;
This insert would still check constraints, foreign keys, fire triggers and build indexes. If you can, it is wise to deactivate indexes and triggers while loading and activate them when done.
Make sure you drop the external table when done, in order to release the lock on the file.
The main problem with external tables is handling of NULLs and BLOBs. If you need to deal with those, you're better off using some tool like FBExport. However, please note that external tables are much faster.
|
|
|
Category |
Firebird Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8342 users |
Added on |
7/23/2015 |
Views |
70508 |
Rate it! |
|
|
Question:
Is there some bulk load or other way to import a lot of data fast?
Answer:
Currently there is only one way to quickly load a lot of data into database. That is by using external tables. You should read the manual for details, but here's a short explanation. You create a binary or textual file using the external table format and then hook it up in the database using a statement like this:
CREATE TABLE ext1 EXTERNAL 'c:myfile.txt' ( field1 char(20), field2 smallint );
To do quick import into regular table, do something like this:
INSERT INTO realtable1 (field1, field2) SELECT field1, field2 FROM ext1;
This insert would still check constraints, foreign keys, fire triggers and build indexes. If you can, it is wise to deactivate indexes and triggers while loading and activate them when done.
Make sure you drop the external table when done, in order to release the lock on the file.
The main problem with external tables is handling of NULLs and BLOBs. If you need to deal with those, you're better off using some tool like FBExport. However, please note that external tables are much faster. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
Is there an example how to configure UdfAccess setting in firebird.conf?
|
View Answer
|
|
What is the best way to determine whether Firebird server is running?
|
View Answer
|
|
Why does reading require write privileges on database file?
|
View Answer
|
|
Is there an example how to configure ExternalFileAccess setting in firebird.conf?
|
View Answer
|
|
Is there a way to detect whether fbclient.dll or fbembed.dll is loaded?
|
View Answer
|
|
Is there a way to automate SQL execution from the command-line, batch job or shell script?
|
View Answer
|
|
Is it possible to determine clients IP address?
|
View Answer
|
|
How to write UDF s in Delphi?
|
View Answer
|
|
How to use events with ZeBeDee, SSH or stunnel?
|
View Answer
|
|
How to tell Firebird to only accept conections from XYZ host or network?
|
View Answer
|
|
How to stop SuperServer service on Linux using only Firebird tools?
|
View Answer
|
|
How to specify transaction or query timeout?
|
View Answer
|
|
How to select a random record from a table?
|
View Answer
|
|
How to repair a corrupt Firebird database?
|
View Answer
|
|
How to reorder the table columns (fields)?
|
View Answer
|
|
How to recreate the index on a Firebird table?
|
View Answer
|
|
How to pump the data from one database to another?
|
View Answer
|
|
How to prevent firebird.log file from filling up the disk partition?
|
View Answer
|
|
How to disconnect the user connection?
|
View Answer
|
|
How to do replication of Firebird databases?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All Firebird Interview Questions & Answers - Exam Mode /
Learning Mode
|