Estimated Row Count Query. How to avoid?

Hi,
I use Jdeveloper 9.0.3. Production to evaluate its capability with swing JClient. I found that before the form is shown on the desktop the framework runs the quety like this.
SELECT /*+ ORDERED USE_NL(RtEmployee) USE_NL(RtUnitmeasure) USE_NL(RtGroupcode) */ count(1) FROM (SELECT RtProduct.PRODUCTID, RtProduct.ID_UM, RtUnitmeasure.SHORTNAMERUS, RtProduct.ID_COMMON, RtProduct.NAMERUS, RtProduct.NAMEENG, RtProduct.ID_GROUPCODE, RtGroupcode.GROUPCODE, RtProduct.IS_GRCODEFAULT, RtProduct.VAT, RtProduct.PRICE_U, RtProduct.MINPRICE, RtProduct.MARKUP, RtProduct.IS_DISCOUNT, RtProduct.NOTE, RtEmployee.SURNAME, RtProduct.CREATEDATE, RtProduct.MODIFYDATE, RtProduct.ID_OPERATOR, RtProduct.ID, RtUnitmeasure.ID AS ID1, RtGroupcode.ID AS ID2, RtEmployee.ID AS ID3 FROM RT_PRODUCT RtProduct, RT_EMPLOYEE RtEmployee, RT_UNITMEASURE RtUnitmeasure, RT_GROUPCODE RtGroupcode WHERE ((RtProduct.ID_OPERATOR = RtEmployee.ID)AND (RtProduct.ID_UM = RtUnitmeasure.ID))AND (RtProduct.ID_GROUPCODE = RtGroupcode.ID))
to estimate dataset cardinality.
Attention development team. Plase pay attention that the statement is badly formed as
Hints entered into "Query Hint" field of the VO is placed in outer query but intended to use in sub query and will not be taken into account by optimizer!
My question is how to avoid this query and/or how can I replace a functionality for estimating dataset cardinality by user defined function or so?
Best regards,
Vyacheslav

I tried the suggested solution but could not figure
out how to get the current query string to extract
the WHERE clause to use in my own query or to get the
parameters to build my own WHERE. How about a more
explicit code example?
Joe:
A few different ways to do this. First, note that getQueryHitCount()
method receives the following parameter:
ViewRowSetImpl viewRowSet
To get the entire query statement, you can call
String entireQuery = vo.getQuery();
For each row set (identified by the viewRowSet parameter), you have a
set of where-clause parameters. Some of these are user provided
(through setWhereClauseParam calls) and some of these are system
provided (system provided params are primarily for view links).
To get all where-clause params (both user and system params), you
call:
Object[] paramVals = viewRowSet.getParametersAsStorageTypes();
Again, paramVals include both user and system param vals.
If you do
int noUserParams = viewRowSet.getWhereClauseParams().length;
noUserParams will tell how many of these are user supplied:
paramVals[0] .. paramVals[noUserParams-1] are user supplied and the
rest are system supplied.
If you want to get the Long postings are being truncated to ~1 kB at this time.

Similar Messages

  • Estimated row count

    hello
    i used estimatedrowcount on several occasions in my application to hide and show certain parts of the screen (normally in EL expressions)
    why is it called ESTIMATED and not EXACT. Of course, there is a reason why i ask,
    sometimes and in certain pages in which i add new row, it is not also the case that the value of EstimatedRowcount is always updated when a new row is inserted. Also what if another use is adding rows through the same page but from a different browser (different instance of the same applications).
    In other words, when does the framework issues SELECT count() on the page to reflect an updated SELECT count().
    In certain situation , i had to create VO in order to make sure that i control that the count() is specifically calculated when i need since i noticed that the default EstimatedRowCount does not always give the expected result and henceforth, could be unwise to depend on it to control the logic
    rgds
    ammar sajdi
    Amman jordan

    You are right, the estimated row count does not query the database every time you call the method. It just is designed to give you the estimated row count in the context of the "current query" of the VO. So, you perform a query. After the query is performed, the table binding, for example, calls the getEstimatedRowCount() method to determine how many rows are to be expected (keep in mind that probably not all rows are fetched at once after the query). Nothing wrong with that. The ViewObject is executed, 20 rows are fetched, the estimated row count tells the binding that there are 100 rows in the result. If then another user inserts a new row, then that typically will have no effect on the 100 rows, meaning you won't get 101 rows at a sudden. If you scroll through the result set, you will get the 100 rows. In order to get 101 rows, you will need to re-execute the query. Then the table binding will get the estimated row count and it will be 101.
    As soon as the fetch is complete, meaning that all rows are fetched from the database and are in memory, then getEstimatedRowCount() no longer accesses the database (why should it?!) but just returns the count of fetched rows. Of course, taking into account any unposted rows that you may have created.
    If you really want the row count from the database, why don't you just call getQueryHitCount()? Why must it be getEstimatedRowCount()?!
    Sascha

  • Problem w/: Error while getting estimated row count for view

    JDev 10.1.3 - Steps
    1. created a ADF VO w/ one bind variable vNAME.
    2. Created a basic jspx page, use the data control pal. to drop in VO w/ executeparam option. Use the data control pal to drop in VO w/ ADF Read-Only Table w/ select and sort option. Selected all VO columns in table.
    3. Following Error msg occurs when running jspx page -
    oracle.jbo.DMLException: Error while getting estimated row count for view object CategoryView, statement SELECT count(1) FROM (SELECT
    CATEGORY.CATID CATID,
    CATEGORY.NAME NAME,
    CATEGORY.PICTURE PICTURE,
    CATEGORY.ACTIVE ACTIVE
    FROM
    CATEGORY
    WHERE
    (CATEGORY.NAME LIKE UPPER(:vName)||'%')) .
    Tested SQL Statement in SQL Worksheet works ok (with a Value replacing ':vName').
    Can anyone advise - seems to be a straight forward process that is returning this error msg. I have tried variations of the SQL stmt with no luck. The jspx page errors when the ADF Read-Only Table is added.

    I seem 2 have the same error, in a slightly different situation.
    I have a view which subclasses a Entity with a history column 'CreatedOn'. When performing a quick search/filter on this column I get the same error. The ADF app is build on a DB2 database, so no named parameters here. Instead invalid SQL is created when executing the estimated row count. The WHERE clause contains 'CreatedOn = null', should be 'CreatedOn is null'. Furthermore the input of my quick search is not filled in this clause.
    Any help would be appreciated

  • Calculating estimated rows in query plan

    Hi,
    I'm trying to do one calculation over statistics, but I can't achieve the correct value.
    The query is the following:
    select * from product where
    productid between 1387 and 1392
    The result for estimated rows is 5,81583.
    The histogram:
    Considering the Avg_Range_Rows field the result should be 6, so I suppose this field is rounded.
    Trying to do the calculation, I notice there are 132 possible key values between the two histogram keys. There are 126 rows (range_rows), so 126/132 = 0.95454545 . Multiply by 6 = 5.72727272, it doesn't achieve the value in query plan.
    Trying the opposite way: 5,81583/6 = 0.969305 * 132=127.94826 . I don't understand how SQL Server is calculating this.
    Thank you for the help !
    Cheers,
    Dennes - Se resolveu, classifique a mensagem, por favor - [http://www.bufaloinfo.com.br] NOVO DVD Segurança no ASP.NET : http://www.bufaloinfo.com.br/LearingSeriesSegurancaASPNET2.asp

    Dennes
    >>>Considering the Avg_Range_Rows field the result should be 6
    It is 1
    AVG_RANGE_ROWS is the average number of rows per distinct value and it is calculated as RANGE_ROWS / DISTINCT_RANGE_ROWS. In your example, we have a total of 126 records
    for 126 DISTINCT_RANGE_ROWS, so that gives, 126/126 = 1 also shown on the histogram for   AVR_RANGE_ROWS
    http://sqlblog.com/blogs/ben_nevarez/archive/2009/09/04/statistics-used-by-the-query-optimizer-in-sql-server-white-paper.aspx
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SyncFx Throughput Estimations - Row Counts per Second?

    We're in the middle of some prototyping work and have many unanswered questions. We're liking what we see from the SyncFx framework overall. We're looking to do some estimations on timing and throughput. Anyone have any experience/wisdom/data on the amount
    of time it takes a SyncFx app to synchronize a table of 500K rows? 
    Table sizes in our production app could vary from 8 to 20 columns and be up to 1M rows from a single production environment. Any thoughts on how long an initial synchronization would take for tables that size?

    I also found this:
    problem found: the JVM is running on Windows XP with netbios over
    TCP/IP activated. On connect() the JVM tries to resolve the hostname
    (java.net.InetAddress.getHostFromNameService, getHostByAddr).
    Windows tries a netbios ns query on udp port 137 with a timeout of
    1500ms, ignores any ICMP "port unreachable" packages and repeats this
    two more times, adding up to a value of 4.5 seconds (!).
    Deactivating netbios "fixes" this, but isn�t always an option ... any
    ideas very welcome.
    Greets,
    guenter <gd--acm-org>

  • Query: how to avoid multiple POs  from being combined into  delivery

    Hi all,
    We are working on an enhancement.
    The requirement is:
    We need to avoid multiple POs from being combined into one delivery.
    Any pointers in this regard would be highly appreciated.
    regards
    Gurpreet

    Hi Murali,
    I think your suggestion should solve Gurpreets problem.
    I have a query here.
    In the copy controls VLTA, defines between sales doc to dlivery doc.
    Here we want to maintain copy control between purchasing doc to delivery doc.
    How do we achive this?
    Also in my view we should write a new combination requirement.
    Please check if combination requirement 51 can be used?
    Regards
    Abhishek

  • How to get row count of a sql query

    After firing a query, how can i get the number of records returned by the query from the database, it should be database indipendent.
    Statement stmt = conn.createStatement();
                      stmt.executeQuery(query);After this I want the number of row i.e. the number of records returned by the database.

    Number of rows in a ResultSet may be obtained with:
    ResultSet rs;
    int numRows=rs.last().getRow();
    I would have said this too, as a matter of fact I mentioned scrollable result sets in my post, but as I said, not all drivers support this, and he said he needed it to be database independent, so this method should not be used.

  • Method for finding row count after executing query

    Is there a method for finding the row count from the resultset after executing a query on a database ?

    The best way: read the data from the result set. If you read it into e.g. a LinkedList, size() will tell you how many rows you got. Or you could increment a counter.
    There are other ways, such as variants of ResultSet that do the read loop for you. But since you'll be doing the fetch loop anyway, those just add unnecessary work and moving parts.

  • How to add the Row count(number of rows in table)  in  the table header?

    Hi,
    I'm having a table. This table is viewed when i click on a search button.
    <b>On the table header it should dynamically display the number of rows in the table, i.e., the row count.</b>
    How to do this? could any one explain me with the detailed procedure to achieve this.
    Thanks & Regards,
    Suresh

    If you want to show a localized text in the table header, you should use the <b>Message Pool</b> to create a (parameterized) message "tableHeaderText" like "There are table entries".
    Next, create a context attribute "tableHeaderText" of type "string" and bind the "text" property of the table header Caption UI element to this attribute.
    Whenever the table data has changed (e.g. at the end of the supply function for the table's data source node), update the header text:
    int numRows = wdContext.node<TableDataSourceNode>().size();
    String text = wdComponentAPI.getTextAccessor().getText
      IMessage<ComponentName>.TABLE_HEADER_TEXT,
      new Object[] { String.valueOf(numRows) }
    wdContext.currentContextElement().setTableHeaderText(text);
    Maybe you want to provide a separate message for the case that there are no entries.
    Alternatively, you can make the attribute calculated and return the header text in the attribute getter.
    Armin

  • How to get row count(*) for each table that matches a pattern

    I have the following query that returns all tables that match a pattern (tablename_ and then 4 digits). I also want to return the row counts for these tables.
    Currently a single column is returned: tablename. I want to add the column RowCount.
    DECLARE @SQLCommand nvarchar(4000)
    DECLARE @TableName varchar(128)
    SET @TableName = 'ods_TTstat_master' --<<<<<< change this to a table name
    SET @SQLCommand = 'SELECT [name] as zhistTables FROM dbo.sysobjects WHERE name like ''%' + @TableName + '%'' and objectproperty(id,N''IsUserTable'')=1 ORDER BY name DESC'
    EXEC sp_executesql @SQLCommand

    The like operator requires a string operand.
    http://msdn.microsoft.com/en-us/library/ms179859.aspx
    Example:
    DECLARE @Like varchar(50) = '%frame%';
    SELECT * FROM Production.Product WHERE Name like @Like;
    -- (79 row(s) affected)
    For variable use, apply dynamic SQL:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Rows count all tables:
    http://www.sqlusa.com/bestpractices2005/alltablesrowcount/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to get the row count of a Table DATA?

    Hi,
      In my Adobe form layout, I have a Table node which is bound to an internal table. Now at runtime, I want to determine the number of rows that the internal table has, i.e the row count of the DATA node of the Table. How will I be able to determine the no. of rows of the internal table at runtime using Javascript? I am not being able to find any suitable answer in this forum. Please suggest. Thanks in advance.

    Hi,
    If you bind the interactive form table to the internal table and specify some properties, the table will vary its row size according to the number of data available in the internal table.
    You have to wrap the table in a sub form,  check 'allow page break with contents' and property 'flowed'.
    the table will automatically increase its row size...
    Is this the reason for which you wanted for the row count..?
    If so, this will help you..
    Regards.
    Surya

  • How to get the row Count of a ResultSet

    How to get the row Count of a ResultSet

    Hi
    I'v tried rennie1's way ,but I only get zero,my code is:
    rs.executeQuery("select count(*) from t_test");
    if (rs.next()) int rowCount=rs.getInt(1);
    I also tried barni's way ,but the method rs.last() and rs.beforeFirst() throw a same Exception
    I tried another way,the code is:
    while rs.next(){
    // Do nothing ,just move the cursour to the last row
    int rowCount=rs.getRow()
    However,the rowCount still equal zero
    Any help would be greatly apprecite!
    note:
    I get connection by DataSource's JNDI name from client, the Server is Weblogic Server 6, the DBMS is Oracle.

  • How to avoid displaying empty rows in a table?

    The situation is as follows:
    I have got a set of questions under a particular category say marketing category.
    The user will be displayed with a table consisting of a set of questions from a particular category with four radio buttons for each question.
    Now once he is done with all the set of questions under a particular category, he will be navigated to the next set of questions under some other category say 'xyz'
    Now instead of creating seperate view objects for each category, we have created a view object which will hold all the set of questions from all the category but will display only the set of questions under a particular category by declaring a variable in the backing bean and setting the question rendering to the value in the variable. the value to the variable will be changed once the user is done with answering all the set of questions under a particular category.
    Now the problem that i am facing is:
    Because of the rendering condition that i have used, it displays only those rows that have the rendering condition set to the variable in the backing and displays all other empty rows overlapped.
    How do i avoid this situation ??

    Seems odd, but you could use COALESCE to achieve this.
    ME_XE?create table all_nullz (col1 number, col2 number, col3 number);
    Table created.
    Elapsed: 00:00:00.20
    ME_XE?
    ME_XE?insert into all_nullz values (1,2,3);
    1 row created.
    Elapsed: 00:00:00.12
    ME_XE?insert into all_nullz values (null, null, null);
    1 row created.
    Elapsed: 00:00:00.06
    ME_XE?
    ME_XE?delete from all_nullz where coalesce(col1,col2,col3) is null;
    1 row deleted.
    Elapsed: 00:00:00.26
    ME_XE?

  • How to increase the ALV visible row count

    Hi Experts,
    My standard ALV display is displaying only 10 rows.
    My requirements is to display 20 rows.
    Please advise.
    Regards,
    Chitrasen

    hi ,
    u can set the row count to any number , here I am setting it to 5 using the method set_visible_row_count
    1 Change the visible row count to u20185u2019
      DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
        DATA lo_value TYPE REF TO cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
        lo_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).
    u can also go thru this useful links for CONFIGUIRING ALV :
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4;jsessionid=(J2EE3417400)ID0488867050DB10849380333905377829End
    SAP List Viewer (ALV) [original link is broken]
    Configuring ALV
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/db22242d-0701-0010-28a2-aeaa1fefd706;jsessionid=(J2EE3414800)ID0133346050DB00727847586176044227End?overridelayout=true&bcsi_scan_06B6B0A4B65849C2=0
    I hope it shud solve ur query.
    regards,
    amit

  • How to avoid submitting a page when tabular form rows are empty

    Hi,
    I have a master detail form in my application. There are 2 tables that are used Table A and Table B. Table A contains Ticket number and Table B refers to Table A through a foriegn key and Table B have columns like Date,Name, Age, ticket_id (that refers to the ticket_number of the Table A).
    This is how the application works:
    In a page there is a field for Ticket Number, once the user enters the Ticket Number and click Add Details, a tabular Form with 5 empty field appears... (Done through Page Process->Data Manipilation->Add Rows)
    This form contains fields Date, Name and Age. Once the user fills in all the details and click Submit button, the page is submitted. Whatever values that was entered is saved in Table B. Page Sucess message appears. This works fine.
    But once the Ticket Number is entered and Add Details is clicked, and without entering the values in the Tabular Form, if Submit button is clicked, there is no error showing up neither I see Page success message. But this should not be allowed. There should be some error showing up...
    Tabular Form Validations works only when user enters some values in the Tabular Form and click Submit. For the above scenario, where the form is untouched the validation doesnt work.
    How can I get this done? Any ideas?

    Hello Suzi,
    >> if (document.wwv_flow==null)
    The document.wwv_flow is an object representing the current form that was just rendered on your screen. As such, it can never be null.
    >> How to avoid submitting a page when tabular form rows are empty
    The correct way, especially for versions prior to APEX 4.0 is to use JavaScript, but for that, you need to know and understand how APEX generates your tabular form, HTML wise.
    To be very brief, APEX attached a unique ID to every updatable cell in the tabular form, using a certain pattern – each updatable column is getting a unique name (e.g. ‘f01’,’f02’ etc.) and the ID of a cell is a combination of this name with the serial row number the cell is on. For example, a cell on the third row in an updatable column called ‘f04’ will be given an ID of f04_0003. (More detailed explanation, with an example, can be found in my book).
    What you should do is to check these cells according to your validation policy (e.g. is all five row must be filled, is all the columns in a specific row must be filled, etc.).
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

Maybe you are looking for