Cursors in teradata

Database

Cursors in teradata

Good morning,

Who can tell me as the creation and use of a cursor in teradata, if possible as I do.

4 REPLIES
N/A

Re: Cursors in teradata

The syntax for cursors is quite similar to other DBMSes.

BUT better try to avoid them (unless you do some metadata driven Dynamic SQL stuff):

Cursors process an answer set sequentially (fetch next) on a single node/PE. This is the slowest way to process data on a parallel database system.

In TD cursors are only allowed in Stored Procedures and this is the main reason why most users don't have the CREATE PROCEDURE right.

What do you want to do with cursors?

Dieter

Re: Cursors in teradata

I need to improve the performance of query execution where a table of about 5000 records matches them to another table of three million records, the problem is that each record in the table of 5000 records has to scan the table b of three million records to see if there is a match and insert it, not that way I can increase the performance of this query to do it faster because the fields that make the comparison and are of type index.

N/A

Re: Cursors in teradata

When it's so easy to compare based on indexes, the optimizer should be able to do it much faster.

Is this the same query you posted in another thread (forums.teradata.com/node/11117)?

I'm shure there is a performant set-based solution instead of a cursor, let's see :-)

Dieter

Re: Cursors in teradata

Thanks again for your answers.