Oracle query is slow (or fails) from .NET app but is fast from SQL Developer

前端 未结 4 2154
陌清茗
陌清茗 2021-02-14 09:58

We use ODP.NET to perform queries on Oracle databases, and normally it works fine. There is a particular database, and a particular view in that database, though, that we just c

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-14 10:50

    Immediate thoughts are

    1. CLOB, BLOB or LONG/LONG RAW which requires a lot of bandwidth for just a few rows.
    2. Invalid data (eg there are ways to get an invalid date into a date field, which may confuse some clients)
    3. "the_table" isn't actually a table but a view or something with a complex derivation or has a VPD/RLS/FGAC security policy on it.
    4. Exotic datatype (Spatial or User Defined).

    Suggestions

    1. Explicitly list the columns (eg SELECT a,b,c FROM the_table WHERE ROWNUM < 5). Add columns one by one until it stops working. That assumes there is at least one 'simple' column in the table.
    2. Check the session in v$session to see what the wait EVENT is. Either the DB server is burning CPU for this SQL, or it is waiting for something (possibly the client).
    3. Check the SQL in v$sql. Is there one or more child cursors. is there one or more PLAN_HASH_VALUEs. Different child cursors can use different plans. Without a WHERE clause other than ROWNUM, this is pretty unlikely.

提交回复
热议问题