1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Efficient difference between two progress queries

Discussão em 'StackOverflow' iniciado por fdantas, Abril 24, 2015.

  1. fdantas

    fdantas Administrator Moderador

    Can anyone explain me why when a I run a query in progress that acts only on one table it runs just in seconds and when i run same query but acting on two tables it runs in hours. Is there any wrong thing that I'm using ?

    Example 1 (Quick query (secs))

    DEF STREAM st1.

    OUTPUT STREAM st1 TO c:\temp\teste.csv.

    FOR EACH db.table_name1 NO-LOCK:

    PUT STREAM st1 UNFORMATTED db.table_name1.atrr1 ";"
    db.table_name1.atrr2 ";"
    db.table_name1.atrr3 ";"

    SKIP.
    END.
    OUTPUT STREAM st1 CLOSE.


    Example 2 (fast query (hours))

    DEF STREAM st1.

    OUTPUT STREAM st1 TO c:\temp\teste.csv.

    FOR EACH db.table1 NO-LOCK,
    EACH db.table2 NO-LOCK


    WHERE
    AND table1.atrr2 = table2.atrr1:

    PUT STREAM st1 UNFORMATTED /* Dados tabela loja */
    db.table1.atrr1 ";"
    db.table1.atrr2 ";"

    /* Dados tabela cliente */

    db.table2.atrr1 ";"
    db.table2.atrr2 ";"
    db.table2.atrr3 ";"

    SKIP.
    END.
    OUTPUT STREAM st1 CLOSE.

    Continue reading...

Compartilhe esta Página