Performance: To use views or cursors, What is better??

We to are about to begin a second phase of development and of my part wanted opinions on the use of views or cursors, I do not compare complexity but performance

Agreed.
My assumption was that we were talking about the difference between
UPDATE some_table
  SET some_column = (result of some view)and
FOR x IN some_cursor
LOOP
  UPDATE some_table
    SET some_column = x.<<something>>
   WHERE some_other_column = x.key
END LOOP;If we're talking about returning data to a client application that is going to be doing row-by-row processing anyway, there is little or no difference.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • Using "View Selector" in the List View Web Part, changes the web part page to the view selected's page.

    Hi,
    I am relatively new to Web Parts pages.  I created a page with list view web part and a Infopath Form Web Part, which are connect via the "Get Form From" option.  My users would like to be able to use views dependent on what
    they are looking for.  So I created different views.  However, when I select the view from within the Web Part, it changes the web part page to the list view page.  I must be doing something wrong.  How do I configure the list view to show
    the selected view and results within the existing "list view web part"?
    Thanks,
    Dwayne

    Hi
    Lindali,
    Sorry, but this has not been answered to my liking.  The "List View Web Part" has the ability for the user to select the view from within the web part, so there you should be able to select a different view and have it appear within the same web part. 
    Does anyone know how to complete this task?
    Thanks,
    Dwayen

  • How to produce a table of contents by using view

    How to produce a table of contents by using view

    I dont understand what u want to know, just give an example ! !

  • Load/Performance Testing using ECATT

    Please provide the process to perform Load/Performance Testing using ECATT ASAP. 
    What are the T-Codes are required to fulfill Load/Performance Testing using ECATT.
    Thanks in ADVANCE.

    Hello Colleague,
    Here are the steps that you need to do, for performance testing using ST30.
    Use transaction ST30 to invoke Global Performance Analysis ( Widely used for performance tests of certain transactions ).
    On the eCATT test tab, Key in the folloing data
    Log ID ( needs to be created ONLY for the first run ),
    Performance test ( logically the entries for Perrformance test field are of the format:
    Logid_name/PERF_transaction_name/systemname/client/date ),
    Name of the testconfiguration ( You need to create a test configuration for the eCATT to be used in ST30, use the same name for the created Test
    configuration as that of the test script ),
    No of times the test configuration needs to be run as the preprocessor to create the required backend data, No of times the test configutation needs to
    run as processor ( both these fields are filled with 5 and 5 or 5 and 10 respectively for performance measurements, but in your case you can give a 1 and 1
    or 0 and 1 in these fields for your requirements )
    With all the check boxes in the Programming guidelines and Distributed Statistics Data unchecked ( unless req ). In the data comparison ( use No - option
    for With values ).
    Click on the eCATT test only button to start the performance run using ST30.
    Now the procedure stated above makes the eCATT test configuration execute as many times as the sum of pre and pro given by the user AT ONE STRETCH ONLY. But if there is a requirement of having the eCATT execute after an interval, we follow a different approach.
    We have a VB script that will create a ECA session, call se37, select the required test package and then execute all the required test cases ( eCATTs ) in the
    test package and also ensure the KILL ECA session at the end of the execution.
    We then create a batch file to execute the VB script and call the batch file for our executions
    In you case, please schedule the execution of the batch file for every 30 mins ( or any such time duration ) using the simple scheduler functionality provided by
    Windows.
    The only problem with this is that whenever we have some system messages / Software updates / any new screens the scheduling is bound to fail as the called VB script does not handle the new situation. Please also ensure that the user whose Password has been given in the scheduler has to be the user who has logged into the system during the execution period.
    So, to summarize : ST30 will only allow you to run the eCATT as many times as required, but only at ONE STRETCH, you need to use the second mechanism to make the eCATT run effectively after a predetermined time without any user interaction.
    FYI : A new feature to handle the scheduling of executions is being developed, will post the details when it is available and the usage steps soon. We also have a new command called PERF ENDPERF in eCATT also ( a new development ), kindly go through the documentations for the new developments in eCATTs for the same
    Thanks and best regards,
    Sachin

  • HT4847 On startup my macbookair says start up disk full/delete some files. When I look at storage disk utility I see 51GB of a possible 60GB is used with Other. What is Other? and how can I view and delete some of these files?

    On startup my macbookair says start up disk full/delete some files. When I look at storage disk utility I see 51GB of a possible 60GB is used with Other. What is Other? and how can I view and delete some of these files?

    A MacBook will use Time Machine to make local backups so that when connected to an external drive it will backup a lot faster.
    to disable this, you must use a command under terminal.
    to locate terminal, do a search for it under spotlight (the magnifying glass on the top right corner), should be the first hit.
    once under terminal, type the following text exactly:
    sudo tmutil disablelocal
    hit enter.
    you will be asked to input your password, if you do not have a password, you will have to create one before performing this command. after entering your password, hit enter again and close terminal.
    in a few minutes the space taken up by time machine should be cleared.

  • I have one HDMI port on my television that is currently used for my hard drive/free view box.  What kind of adaptor can I buy so I can have the hard drive and my apple tv device plugged into the same HDMI PORT?

    I have one HDMI port on my television that is currently used for my hard drive/free view box.  What kind of adaptor can I buy so I can have the hard drive and my apple tv device plugged into the same HDMI PORT? Is it a switch or a splitter?  And where is it best to buy one?  Thanks!

    Welcome to the Apple Community.
    You need an HDMI switch.

  • When i use view as list in finder and open a folder with many files i cant right click with mouse without selecting or highlighting a file....i just want to right click to paste an item or create a new folder...what can i do?

    When i use view as list in finder and open a folder with many files i cant right click with mouse without selecting or highlighting a file....i just want to right click to paste an item or create a new folder...what can i do?

    Thx for that im gonna try it....but is there a way to do it without using toolbar or cmd-c...? i mean using only the mouse?why does it have to highlight the file even though i click a bit next to it....?using icon view i can right click next to the folder and i wont have a problem but with list view that i prefer using it will highlight the whole row.....and i dont find free space to right click cause i got many files

  • What are the limitations in terms of data size  or performance while using csv or text file as datasource?

    <p>Also what are the limitations in terms of data size  or performance related issues while using csv or text file?</p><p>Is it the best practice to use csv , text file to use as a datasource to improve performance?</p><p>Please Advice.... </p><p>&#160;</p>

    <p>Hi,</p><p>Create Same Data Input for CSV and Text File ,Create 2 different reports one for CSV and One for Text ,run them one you have done that.</p><p>Go to Report Menu and Select Performance Information .Use the Data in that to check which one is good datasource to improve performance</p><p>Cheers</p><p>Rahul</p>

  • When I use View Options I click on "Album" but what shows up is  "Album by Artist/Year".  How do I ger only "Album"?

    When I use View Options I click on "Album" but what shows up is  "Album by Artist/Year".  How do I ger only "Album"?

    jeffreyfromsouth windsor wrote:
    When I use View Options I click on "Album" but what shows up is  "Album by Artist/Year".  How do I ger only "Album"?
    Click on the words "Album by Artist/Year," one click at a time, and it will cycle through the possible options. 
    One of them is juts plain "Album."

  • What are the advantages to using a REF cursor

    When would I want to use a REF cursor?

    REF CURSORs are not cursors, they're references to cursors. This means they're dynamic. So you can completely change the query executed by the cursor.
    For example you can use a REF CURSOR to select from one of a number of tables (depending on an input parameter or other sort of flag). The results are fetched into the same resultset holder and hence you only need a single lot of code to process the results.
    Also you can also pass a REF CURSOR as a argument to other PL/SQL procedures and functions.
    rgds, APC

  • Why the every time Empty view is created. what is the  use of Empty view?

    Hai Experts,
                         im working  on Web Dynpro ABAP i have doubt when ever we create the component One window and
                         one View created by default.but logicaly one empty view also created (not physically).
                         can u please explain me why the empty view is created what is the usde of it.
                           this is not a interview question .i searched the forums i cant get answer.
    Thanks in adv.

    hi ,
    empty is not a mandatory thing in webdynpro component ..  but to get the perfect picture about  the importance and usage of this  Empty views and Empty windows. * i suggest you to check the statefull stateless webdynpro componet and relate the same*
    pl find the same in below URL:
    [http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/e0/202d4108f08739e10000000a1550b0/content.htm]
    hope it helps you,
    Regards,
    Kranthi.

  • Problem declaring and using a REF CURSOR

    I'm having a real problem using a REF CURSOR type
    Here's the DECLARE and the start of the BEGIN I've so far developed.
    DECLARE
    TYPE r1 IS RECORD (
    szvcapc_pidm szvcapc.szvcapc_pidm%TYPE,
    szvcapc_term_code szvcapc.szvcapc_term_code%TYPE,
    szvcapc_request_no szvcapc.szvcapc_request_no%TYPE);
    szvcapc_rec r1;
    TYPE cursor_1 IS REF CURSOR RETURN r1;
    szvcapc_cv cursor_1;
    TYPE r2 IS RECORD (
    stvests_code stvests.stvests_code%TYPE
    stvests_rec r2;
    TYPE cursor_2 IS REF CURSOR RETURN stvests_rec;
    stvests_cv cursor_2;
    BEGIN
    OPEN szvcapc_cv FOR
    SELECT szvcapc_pidm, szvcapc_term_code, szvcapc_request_no
    FROM szvcapc
    WHERE szvcapc_passed_ind = 'Y'
    AND szvcapc_award_credits = 'N';
    LOOP
    FETCH szvcapc_cv INTO szvcapc_rec;
    EXIT WHEN szvcapc_cv%NOTFOUND;
    END LOOP;
    OPEN stvests_cv FOR
    SELECT stvests_code
    FROM stvests
    WHERE stvests_eff_headcount = 'Y';
    LOOP
    FETCH stvests_cv INTO stvests_rec;
    EXIT WHEN stvests_cv%NOTFOUND;
    END LOOP;
    SELECT *
    FROM (
    <snip>
    INNER JOIN stvests_rec
    ON SFBETRM.SFBETRM_ESTS_CODE = stvests_rec.STVESTS_CODE
    <snip>
    I later try to use the stvests_rec and szvcapc_rec in the main SELECT statement it doesn't recognise stvests_rec and szvcapc_rec as a "Table or View".
    I have to use a REF CURSOR as this code is ultimately for use in Oracle Reports.
    What am I doing wrong?

    > The reason I'm trying to use a REF CURSOR is that I was told that you
    couldn't use CURSORs in Oracle Reports.
    That does not change anything ito what happens on the Oracle server side. A cursor is a cursor is a cursor.
    Every single SQL winds up as a cursor. Each cursor has a reference handle to access and use. HOW this handle is used in the language differs. But that is a language issue and not an Oracle RDBMS issue.
    For example. An EXECUTE IMMEDIATE in PL/SQL creates a cursor handle and destroys it after use - automatically. An implicit cursor works the same. An explicit cursor you have the handle fetch from it and close from it when done.
    A ref cursor is simply a handle that can be returned to an external client - allowing that application to use the handle to fetch the rows.
    Do not think that a ref cursor is any different from the RDBMS side than any other cursor. The RDBMS does not know the difference. Does not care and nor should it.
    > I'm trying to reduce the hits on the database from nested selects by
    removing the dataset from the main SELECT statement and performing it only
    once outside and then referencing this previously collected dataset inside the
    main SELECT statement.
    Good stuff that you are considering SQL performance. But you need to make sure that you
    a) identify the performance inhibitor issue correctly
    b) address this issue correctly
    And you need to do that within SQL. Not PL/SQL. PL/SQL will always be slower at crunching data than SQL. For example, wanting to cache the data somehow to reduce the read overhead - that is exactly what the DB buffer cache does. It caches data. That is also exactly what the CBO will attempt - reduce the amount of data that needs to be read and processed.
    Not saying that the RDBMS can do it all. It needs help from you - in the form of a SQL that instructs it to process only the minimum amount of data required to get the required results. In the form of a sound physical design that provides optimal usage of data storage and access (like indexing, partitioning, clustering, etc).
    Bottom line - you cannot use a REF CURSOR to make a SQL go faster. A REF CURSOR is simply a cursor in the SQL Engine. A cursor is nothing but the "compiled-and-executable" code of a SQL "source program".

  • BOXI3.0 Universe Design using view or query in SQL

    Hi. Alias here.
    I would like to know what are the effect to the BOXI3.0 or SQL performance if:
    1. We are using view or query in creating the universe?
    2. Is it the correct way of creating the universe only from tables?
    3. If need to do combination between tables and views?
    Hope you all can reply to this matter.
    Regards,
    Alias

    Hi Alias,
    Designer has the capability to import tables and views you cna use in the design of the universe. Furthermore, you can also create a derived table in the universe - in simple terms it is much like a view, but the code is in the universe availble to the universe designer.
    With all this available to you, it is pretty much up to you how you want to tackle the design. I would say first prise is using the physical tables in the databse, then move to using a view and if there are certain restrictions on the designer, use the derived tables.
    Remeber this, at the end of the day, any SQL code generated or used is passed down to the database to be processed, may it be the query from the universe directly on the tables or by means of the views or derived tables - the database server will need to crunch through it all - and this is what will determine your performance.
    Regards
    Jacques

  • ETL for Data warehouse - use view instead of transformations?

    When populating staging tables, is anyone else using this approach of using a view - as opposed to transformations within your ssis dataflow ?  I had not thought of this approach, but I suppose it results in the same goal - to get the wanted schema
    for data flowing into the destination.  I suppose it would be just a matter of using the view as your source - as opposed to the underlying table(s), followed by transformations before the destination?

    Hi sb,
    I would say that it depends.  You want your load to be efficient and your want your load to be simple and easy to enhance later.  Sometimes these goals can be conflicting, so you need to decide what's important for your implementation.
    Regarding efficiency, you will typically be better off with a view as the filtering, lookups etc will be done at source, so less data transferred to your staging area.  For example, the view might only ask for 12 of 25 columns in a source table, so
    you will be bringing over, perhaps, half the amount of data.  Another example, your view might join two tables at source, while another design option would bring over all of the larger table and perform a lookup (on the smaller table) for each record
    of the larger table.  This could be extremely inefficient if each lookup went back to source.
    Regarding easy enhancements, in the first example, if you bring over all 25 columns, you might find it easier to add one of the, as yet, unused 13 columns.  Regarding the second example above, with views, there is a risk that a new view will be created
    for new requirements, resulting in multiple views importing overlapping data.  You really only want to import each datum once, with no duplication.  Note; duplication is unlikely if the views are essentially one view per logical table in the source
    system.
    I've sat on the fence a bit answering this question, but it really does depend, and it is a big question.  What you need to do is understand the ramifications of the design you implement.  Having qualified my response, I very often use views to
    perform simple 1:1 mainipulation of the source data.
    Hope that helps a little,
    Richard

  • Query using views

    Since the query is too big, I have removed the query from the post.
    I would like to know whether using views in SQL queries degrade the performance of the queries?
    When views are used in sql queries, the operation 'FILTER' is displayed in the explain plan, however the cost doesnt seem to be high. If the views can be replaced by the base tables, it is better to do so?
    Edited by: user642116 on Nov 8, 2008 11:13 PM

    user642116 wrote:
    I have a main table called NATURAL_PERSON. There are several child tables based on this table, for e.g. PERSONAL_DETAILS, NATIONALITY_PERSON, CIVIL_STATUS etc. All these child tables have a foreign key NPN_ID which is joined with the ID of NATURAL_PERSON.
    I need to obtain data from these child tables and present in them xmlformat.
    A part of the query used is as below
    SELECT npn.ID npn_id,
    CONVERT(xmlelement("uwvb:NaturalPerson",
              XMLForest(LPAD(npn.nat_nummer,9,0) AS "uwvb:NatNr"),
              (XMLForest(LPAD(per.a_nummer, 10, 0) AS "uwvb:ANr"
              (SELECT XMLFOREST
                        (code_status AS "uwvb:ResidenceStatus")
                        FROM ebv_v_nep nep
                        WHERE npn_id = npn.ID
                        AND nep.nem_code = 'VBT'
                        AND nep.transactid =
                        (SELECT MAX (nep_i.transactid)
                             FROM ebv_v_nep nep_i
                             WHERE nep.npn_id = nep_i.npn_id
                             AND nep_i.nem_code = 'VBT'))
              entityelement),'WE8MSWIN1252', 'UTF8')
    FROM ebv_v_npn npn, ebv_v_per per
    WHERE npn.ID = per.npn_id
    As seen in the above query, views have been defined for all the tables. For e.g. the view ebv_v_npn is based on NATURAL_PERSON, ebv_v_per is based on PERSONAL_DETAILS, ebv_v_nep is based on RESIDENCE STATUS. All these views are independent of each other and do not contain common tables in their definition.
    The views can be replaced by the base tables as i dont see any advantage of using the views. I would like to know whether replacing the views with the base tables would also help to improve the performance.Replacing the views with the base tables might help, since not always Oracle is able to merge the views, so sometimes certain access paths are not available when working with views compared to accessing the base tables directly.
    You can see this in the execution plan if there are separate lines called "VIEW". In this case a view wasn't merged.
    The particular query that you've posted joins two views in the main query and (potentially) executes a scalar subquery that contains another correlated subquery for each row of the result set. "Potentially" due to the cunning "Filter optimization" feature of the Oracle runtime engine that basically attempts to cache the results of scalar subqueries to minimize the number of executions.
    If the statement doesn't perform as expected you need to find out which of the two operations is the main contributor to the statement's runtime.
    You can use DBMS_XPLAN.DISPLAY to find out what the FILTER operation you mentioned is actually performing (check the "Predicates Information" section below the plan output), and you can use SQL tracing to find out which row source generates how many rows. The following document explains how to enable SQL tracing and run the "tkprof" utility on the generated trace file: When your query takes too long ...
    The correlated subquery of the scalar subquery that is used to determine the maximum "transactid" may be replaced with a version of the statement that uses an analytic function to avoid the second access to the view (note: untested):
    SELECT npn.ID npn_id,
      CONVERT(xmlelement("uwvb:NaturalPerson",
              XMLForest(LPAD(npn.nat_nummer,9,0) AS "uwvb:NatNr"),
              (XMLForest(LPAD(per.a_nummer, 10, 0) AS "uwvb:ANr"
              (SELECT XMLFOREST
        (code_status AS "uwvb:ResidenceStatus")
        FROM (
          SELECT code_status,
          RANK() over (PARTITION BY npn_id ORDER BY transactid desc) as rnk
          FROM ebv_v_nep nep
          WHERE nep.npn_id = npn.ID
          AND nep.nem_code = 'VBT'
        where rnk = 1)
        entityelement),'WE8MSWIN1252', 'UTF8')
    FROM ebv_v_npn npn, ebv_v_per per
    WHERE npn.ID = per.npn_idRegards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/
    Edited by: Randolf Geist on Nov 10, 2008 9:27 AM
    Added the rewrite suggestion

Maybe you are looking for

  • X1 and an additional screen

    Hi there, I would like to use my X1 as primary screen and my additional 27" display as secondary. I bought the USB 2.0 port replicator, but I dont like it very much at all. It is lagging and not that functional as I would have liked, which is why I w

  • Large external HDs not recognized by Windows 7 64-bit

    Hi, I'm trying to see if someone else out there has had this same problem have has been able to solve it. I have an HP Pavilion DV6 - NQ615AV Entertainment Center PC. I'm running Windows 7 Professional 64-bit SP1. I have several external USB hard dri

  • Error message when updating itunes tv shows to ipod

    I purchased the orgignal 4 episode pilot of battlestar galactica from itunes. The first 2 episodes transfered to my ipod but i now get an error when it attempts to transfer the next. Attempting to copy to disk "my ipod" failed. The disk could not be

  • Sql*Plus Report

    Hi, I want to spool the results of a query to a file in Sql*Plus. The only problem I have with this is that Sql*plus is adding a blank line at the end of the file. This file is being used as input to another process and the blank line is causing prob

  • Employee Trasfers with same HR Positions

    HI...HR Experts We would like to build a system control in HR space that when ever there are INTERNAL Transfer happens , We want HR Admins should not be able to transfer the person with Same Position. May we request experts to throw some light on our