MULTILOAD
252.Explain Multi Load in Teradata?
- Used for loading, updating or deleting data to and from populated tables, typically with batch inputs from a host file.
- Cannot process tables defined with USI’s, Referential Integrity, Join Indexes, Hash Indexes, or Triggers.
- No data retrieval capability.
- Import tasks require use of Primary Index
- The Multiload supports five target tables per script.
- Tables may contain pre-existing data.
- Ability to do INSERTs UPDATEs, DELETEs and UPSERTs.
- Error tables should be dropped manually, as RELASE MLOAD will not drop them automatically.
- Loads up to 5 tables at a time.
- Does not mind loading duplicate data.
- Loads the data into the Table whether it can be either empty or full.
- It needs 2 error tables, 1 restart log table and 1 work table.
- It supports NUSI table loading loading.
- It applies write lock on target Table table during loading.
- Block utility in 64K block
253..What are the MultiLoad Utility limitations?
- MultiLoad is a very powerful utility; it has following limitations:
- MultiLoad Utility doesn’t support SELECT statement.
- Concatenation of multiple input data files is not allowed.
- MultiLoad doesn’t support Arithmetic Functions i.e. ABS, LOG etc. in Mload Script.
- MultiLoad doesn’t support Exponentiation and Aggregator Operators i.e. AVG, SUM etc. in Mload Script.
- Import task require use of PI (Primary Index).
- MultiLoad loads to populated Teradata tables in 64K blocks via Inserts, Updates, Deletes and Upserts.
- No Unique Secondary Indexes (USI), but Non-Unique Secondary Indexes (NUSI) are allowed..Supports up to five populated tables.
- No concatenating input files.Loads data in 64K blocks and only 30 FastLoad and MultiLoad combinations can run simultaneously.
- No Secondary Indexes (FastLoad)
- No Unique Secondary Indexes (FastLoad and MultiLoad)
- No Triggers (FastLoad and MultiLoad)
- No Join Indexes (FastLoad and MultiLoad)
- No Referential Integrity (FastLoad and MultiLoad)
- Only 30 FastLoad and MultiLoad combinations can run at one time.
- Only 60 FastExport jobs can run simultaneously!
Referential Integrity and Load Utility Solutions
FastLoad and MultiLoad don’t support Batch Referential Integrity, so the above examples are two approaches to solving the problem.
MultiLoad has IMPORT and DELETE Tasks
DO INSERT FOR MISSING UPDATE ROWS ;
The keywords you can’t forget for an UPSERT MultiLoad are listed above in red and are: DO INSERT FOR MISSING UPDATE ROWS. That tells Teradata to first try and do an Update, and if it is successful move on. But, if the Update fails, then do an Insert.
254.Name the five phases that come under MultiLoad Utility.
MultiLoad has Five Phases
|
Preliminary Phase • Basic Setup. |
|
DML Transaction Phase • Get DML steps down onto the AMPs3 |
|
Acquisition Phase • Send the input data to the AMPs and sort it. |
|
Application Phase • Apply the input data to the appropriate Target Tables. |
|
Cleanup Phase • Basic Cleanup |
255.A MultiLoad Delete is often better than an SQL Delete
- The MultiLoad DELETE mode is used to perform a global (all AMP) delete on just one table.
- .BEGIN DELETE MLOAD is that it bypasses the Transient Journal (TJ) and can be RESTARTED if an error causes it to terminate prior to finishing.
- MultiLoad DELETE Rules
- DELETE tasks operate differently than IMPORT tasks.
- Deleting based on equality on a Unique Primary Index is not allowed.
- Deleting based on inequality such as < or > is allowed.
- Deleting a Non-Unique Primary Index on equality is allowed.
- A MultiLoad Delete is often better than an SQL Delete because:
- MultiLoad Delete is faster
- No Transient (WAL) Journal
- MultiLoad Delete is restartable
MultiLoad DELETE Rules
- DELETE tasks operate differently than IMPORT tasks.
- Deleting a Non-Unique Primary Index on equality is allowed.
- MultiLoad Delete if faster
- MultiLoad Delete is restartable
- The MultiLoad DELETE mode is used to perform a global (all AMP) delete on just one table.
- .BEGIN DELETE MLOAD is that it bypasses the Transient Journal (TJ) and can be RESTARTED if an error causes it to terminate prior to finishing.
- When performing in DELETE mode, the DELETE SQL statement cannot reference a Unique Primary Index in the WHERE clause with equality.
- This due to the fact that a primary index access is to a specific AMP; this is a global operation.
256.sample script
257. What is the process to restart the multiload if it fails?
- MULTILOAD will creates 2 error tables, 1 work table
- When MULTILOAD fails We have to unlock the Main Table, here error tables and work tables are not locked like FLOAD
- To Unlock the Main Table in Mload RELEASE MLOAD <TABLE NAME>;
- The above ans is only when the MLOAD failed in acquisition phase To release lock in application phase failure in MLOAD RELEASE MLOAD <Table Name> .IN APPLY;
Troubleshooting MultiLoad
- If the MultiLoad job fails, you can restart the job and it will continue where it left off.
- If Teradata goes down, the MultiLoad will continue where it left off, without user intervention, when Teradata data comes back.
- If all else fails, you can use the RELEASE MLOAD statement below and start over.
- RELEASE MLOAD SQL01.Employee_Table ;
Sometimes the MultiLoad can be restarted and sometimes it is in point of no return. - Here are some troubleshooting suggestions:
- Make sure the MultiLoad is not running and if it is still running you can ABORT the MultiLoad (still restartable if ABORTED).
- Enter RELEASE MLOAD TableName
- If Successful, drop all the work and error tables.
- If not successful, restart MLOAD and let it complete, or dropt target, work, and Error Tables.
The RELEASE MLOAD statement can be quite valuable during desperate times.
258.Five Formats of MultiLoad Files
Binary• Each record is a 2-byte integer, n, that is followed by n bytes of data. A byte is the smallest means of storage for Teradata.
FastLoad• This format is the same as Binary, plus a marker (X ‘0A’ or X ‘0D’) that specifies the end of the record.
Text• Each record has a random number of bytes and is followed by an end of the record marker.
Unformat• The format for these input records is defined in the LAYOUT statement of the MultiLoad script using the components FIELD, FILLER and TABLE.
Vartext• This is variable length text RECORD format separated by delimiters such as a comma. For this format you may only use VARCHAR, LONG VARCHAR (IBM) or VARBYTE data formats in your MultiLoad LAYOUT. Note that two delimiter characters in a row will result in a null value between them.
259.A NoPI Table Does Not Work with MultiLoad
- A NoPI Table has NO PRIMARY INDEX so it does Not work with MultiLoad!
- A NoPI Table has no primary index.
- A NoPI table guarantees even distribution. A MultiLoad IMPORT works by utilizing the table’s Primary Index.
- A NOPI table stands for NO PRIMARY INDEX and therefore MultiLoad won’t work with this type of table.
Error Tables are dropped if there are not errors, but you can query the error tables.
260.Host Utility Locks (HUT Locks)
There are two types of Host Utility Locks (also referred to as HUT Locks)
:Acquisition locks – Prevent all DDL statements (except DROP) from running against the table(s) being MultiLoaded, but allow for the all DML statements such as SELECT
.Application Locks – Prevent all DDL statements (except DROP) from running against the table(s) being MultiLoaded, but allow for users to run SELECT statements only if they use an ACCESS Lock.
Although MultiLoad seems pretty intense, it never places an Exclusive lock inside the job. If you decide you want to trouble-shoot a MultiLoad job so you want to look at the logtable, the work tables, or any of the error tables, you must use an ACCESS Lock in your SQL to avoid abnormally terminating the MultiLoad job due to locking problems.
Locking Row for ACCESS
SELECT DISTINCT ErrorCode ,ErrorFieldName FROM SQL01.Emp_ET;
Although MultiLoad seems pretty intense, it never places an Exclusive lock inside the job.
If you decide you want to trouble-shoot a MultiLoad job so you want to look at the logtable, the work tables, or any of the error tables, you must use an ACCESS Lock in your SQL to avoid abnormally terminating the MultiLoad job due to locking problems
261. Give a justifiable reason why Multiload supports NUSI instead of USI.
The index sub-table row happens to be on the same Amp in the same way as the data row in NUSI. Thus, each Amp is operated separately and in a parallel manner.
Whenever we define a Secondary index, an Secondary index subtable will be created.In case of UPI, when they go for has distribution subtable is in one AMP and actual data row pointed by USI subtable is in another AMP. So the AMPs need to communicate, which is not supported by Multiload.
- But in case of NUSI, the subtable and the references of the actual data will store in the same AMP hence AMPs no need to communicate here. So in case of NUSI, AMPs work in parallel and hence Mload supports that.
262.How is MLOAD Client System restarted after execution?
The script has to be submitted manually so that it can easily load the data from the checkpoint that comes last.
263.How is MLOAD Teradata Server restarted after execution?
The process is basically carried out from the last known checkpoint, and once the data has been carried out after execution of MLOAD script, the server is restarted.
264.How do you transfer large amount of data in Teradata?
Transferring of large amount of data can be done by using the various Teradata Utilities i.e. BTEQ, FASTLOAD, MULTILOAD, TPUMP and FASTEXPORT.
- BTEQ (Basic Teradata Query) supports all 4 DMLs: SELECT, INSERT, UPDATE and DELETE.BTEQ also support IMPORT/EXPORT protocols.
- Fastload, MultiLoad and Tpump transfer the data from Host to Teradata.
- FastExport is used to export data from Teradata to the Host.
265.Difference between MultiLoad and TPump in Teradata?
- Tpump provides an alternative to MultiLoad for low volume batch maintenance of large databases under control of a Teradata system.
- Tpump updates information in real time, acquiring every bit of a data from the client system with low processor utilization.
- It does this through a continuous feed of data into the data warehouse, rather than the traditional batch updates.
- Continuous updates results in more accurate, timely data.
- Tpump uses row hash locks than table level locks.
- This allows you to run queries while Tpump is running.
266.Which is faster – MultiLoad delete or Delete command in Teradata?
- MultiLoad delete is faster than normal Delete command, since the deletion happens in data blocks of 64Kbytes, whereas delete command deletes data row by row.
- Transient journal maintains entries only for Delete command since Teradata utilities doesn’t support Transient journal loading
- For smaller table deletes, simple DELETE command is enough.
- Multiload delete is useful when the delete has to be performed on a large table in teradata.
267.How to Skip or Get first and Last Record from Flat File through MultiLoad in Teradata?
- In .IMPORT command in Mload we have a option to give record no. from which processing should begin. i.e. ‘FROM m’ ‘m’ is a logical record number, as an integer, of the record in the identified data source where processing is to begin. You can mention ’m’ as 2 and processing will start from second record.
- THRU k and FOR n are two options in the same Mload command, functions same towards the end of the processing. Adding to the above, if from m”start record” and for n “stop record” are not mentioned, mload considers records from start till the end of the file