Query in teradata taking long time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • resmi318
    New Member
    • Jun 2007
    • 29

    Query in teradata taking long time

    I am running a query similar to given below.

    CREATE TABLE ABC_08
    AS
    (SELECT x.col1,
    trim(x.col2),
    x.col3,
    x.col4,
    x.col5
    FROM Table1 x
    LEFT OUTER JOIN
    Table2 c
    on x.col1 = c.col1
    WHERE (col4 NOT LIKE '%DC'
    AND x.col3 in (SELECT col3 FROM Table3)
    AND trim(x.col2) in (SELECT col2 from Table4)
    AND x.col5 NOT IN (SELECT col5 FROM Table5) ))
    WITH DATA;

    This query is taking lots of time whereas when I try to select only,it is giving immediate result.

    SELECT x.col1,
    trim(x.col2),
    x.col3,
    x.col4,
    x.col5
    FROM Table1 x
    LEFT OUTER JOIN
    Table2 c
    on x.col1 = c.col1
    WHERE (col4 NOT LIKE '%DC'
    AND x.col3 in (SELECT col3 FROM Table3)
    AND trim(x.col2) in (SELECT col2 from Table4)
    AND x.col5 NOT IN (SELECT col5 FROM Table5)


    I am converting oracle script to teradata. The oracle equivalent for the above one is not taking much time to create table. It does not contain a primary index in oracle so I didnt provide the same in teradata. Table1 contains about 190000 records. Please help me

    Thanks
    resmi318
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Try this:

    Create a GLOBAL TEMPORARY TABLE in oracle and insert the data of your select query in to the GTT. Once done, use GTT in teradata to create a table there. Post back in case of any issues!!

    Comment

    • resmi318
      New Member
      • Jun 2007
      • 29

      #3
      Originally posted by amitpatel66
      Try this:

      Create a GLOBAL TEMPORARY TABLE in oracle and insert the data of your select query in to the GTT. Once done, use GTT in teradata to create a table there. Post back in case of any issues!!
      Thanks for your reply. But I am using two different machines. Terdata and Oracle servers are different. I am ftping the oracle scripts to teradata machine and converting the same

      Thanks
      Resmi318

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by resmi318
        Thanks for your reply. But I am using two different machines. Terdata and Oracle servers are different. I am ftping the oracle scripts to teradata machine and converting the same

        Thanks
        Resmi318

        I understand that they are two different machine. Noe please clarify are you looking for transfering the data from teradata to oracle database and how you are doing that??

        Comment

        • resmi318
          New Member
          • Jun 2007
          • 29

          #5
          Originally posted by amitpatel66
          I understand that they are two different machine. Noe please clarify are you looking for transfering the data from teradata to oracle database and how you are doing that??
          I needed some tables in Oracle which I exported as flatfile and created in teradata. I dont have any issue here.
          Now the problem is in running queries on the teradata machine.It is taking long time create table and even update statements.

          Thanks
          Resmi318

          Comment

          Working...