TIME OUT

  • 1 only one specific user query return timeout(may be due to thousand of records) but out of 300 users this query return time out only one specific user why?

    Update Table1 set viewflag=1 where nid in(select nid from table2 where bid=31) and userid=350

    my question is what is the best practices subquery is faster or

    achieve the same result through loop one by one instead of subquery

    2 select * from test123(ReadPast)

    is it good practice to use ReadPast?

    or use nolock?

    3 for j=0 to dt.rows.count-1

    userid=dt.rows(j).item("UserID")

    obj.getMethod1( userid )

    in this method we use this query in loop

    Update Table1 set viewflag=1 where nid in(select nid from table2 where bid=31) and userid=350

    next

    is it good practice

    or we use

    for j=0 to dt.rows.count-1

    userid=dt.rows(j).item("UserID")

    userid=userid & ","

    next

    obj.getMethod1( userid )

    in this method we use this query

    Update Table1 set viewflag=1 where nid in(select nid from table2 where bid=31) and userid in (userid,..,,)

    any body suggest which one is efficient approach and faster

    or

    alternative solution

  • If you run the following, how many rows do you get?

    select nid from table2 where bid=31

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply