Query on Oracle Concepts: Table Compression

The attributes for table compression can be declared for a tablespace, table, or table partition. If declared at the tablespace level, then tables created in the tablespace are compressed by default. You can alter the compression attribute for a table, in which case the change only applies to new data going into that table. Consequently, a single table or partition may contain compressed and uncompressed blocks, which guarantees that data size will not increase because of compression. If compression could increase the size of a block, then the database does not apply it to the block.
Can anybody please explain text marked as bold? How can data-size/block-size can increase by compression?
Regards,
Ankit Rathi
http://oraclenbeyond.blogspot.in

>
The attributes for table compression can be declared for a tablespace, table, or table partition. If declared at the tablespace level, then tables created in the tablespace are compressed by default. You can alter the compression attribute for a table, in which case the change only applies to new data going into that table. Consequently, a single table or partition may contain compressed and uncompressed blocks, which guarantees that data size will not increase because of compression. If compression could increase the size of a block, then the database does not apply it to the block.
Can anybody please explain text marked as bold? How can data-size/block-size can increase by compression?
>
First let's be clear on what is being said. The doc says this:
>
If compression could increase the size of a block, then the database does not apply it to the block.
>
That is misleading because, of course, the size of the block can't change. You should really read that as
>
If compression could increase the size of the data being stored in a block, then the database does not apply it to the block.
>
There is overhead associated with the compression because the metadata that is needed to translate any compressed data back into its original state is stored in the block along with the compressed data.
The simplest analogy (though not a perfect one) is the effect you can get if you try to zip an already highly compressed file.
For example, if you try to use Winzip to compress an image file (jpg, gif, etc) or a video file you can easily wind up with a zip file that is larger than the uncompressed file was to begin with. That is because the file itself hardly compresses at all but the overhead of the zip file adds to the ultimate file size.
I suggest you edit your thread subject since this question is NOT about partitioning.

Similar Messages

  • Query on Oracle Concepts: Advantages of ASSM

    Hi,
    A query on Oracle Concepts, specifically on Advantages of ASSM.
    While I am able to understand 'Simplified administration' & 'Increased concurrency', can anyone mention this in simple terms:
    • Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment.I guess I know whats Oracle RAC but what it meant by 'Dynamic affinity of space to instances'?
    Regards,
    Ankit Rathi

    Hi Aman,
    I was going through Oracle® Database Concepts 11g Release 2, Chapter 12 Logical Storage Structures (link below):
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/logical.htm#i19599
    *Automatic Segment Space Management*
    The ASSM method uses bitmaps to manage space. Bitmaps provide the following advantages:
    •Simplified administration
    ASSM avoids the need to manually determine correct settings for many storage parameters. Only one crucial SQL parameter controls space allocation: PCTFREE. This parameter specifies the percentage of space to be reserved in a block for future updates (see "Percentage of Free Space in Data Blocks").
    •Increased concurrency
    Multiple transactions can search separate lists of free data blocks, thereby reducing contention and waits. For many standard workloads, application performance with ASSM is better than the performance of a well-tuned application that uses MSSM.
    •Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment
    ASSM is more efficient and is the default for permanent, locally managed tablespaces.Regards,
    Ankit Rathi

  • Oracle 10g: Table Compress

    Guys,
    I was reading an article about table compression that I was reading for data warehousing environment.
    http://www.oracle.com/technology/products/bi/db/10g/pdf/twp_data_compression_10gr2_0505.pdf
    I didnt understand couple of things like
    Oracle’s compression algorithm is based upon eliminating duplicate values in each block - what does eliminating duplicate values in each block mean
    ALTER TABLE ... MOVE COMPRESS works in 10g what is its equivalent in Oracle 9i.
    Also is there a concept of table compression in Oracle 9i
    Any inputs/suggestions would help
    Thanks

    what does eliminating duplicate values in each block meanThat a compression method. Have only once the same info. That doesn't drop from the table duplicate rows. Important phrase is here :
    "Duplicate values in all the rows and columns in a block are stored once at the beginning of the block, in what is called a symbol table for that block. All occurrences of such values are replaced with a short reference to the symbol table."
    Also is there a concept of table compression in Oracle 9iThere is such thing :
    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_73a.htm#2128735
    Nicolas.

  • Oracle 11g table compression feature

    Is anybody using Oracle 11g's compression feature in production? I read a whitepaper on this and also read some forums/threads on this topic and so far I haven't read anything negative yet, that doesn't meant that there isn't anything that could have an adverse affect. I wanted to check with you guys out there to see if anyone is really using is this feature in production and see if there are any affects on the performance or any disadvantages of using this compression feature. I have tested this on one my major tablespace and I did see a big difference in the reduce size on the tablespace but I am still hesitated to put this into production. I would like to hear from you guys to see what you guys think?

    I have tested this on one my major tablespace and I did see a big difference in the reduce size on the tablespace but I am still hesitated to put this into production.Nothing better than testing the solution before you can put into real.
    http://www.oracle.com/technetwork/articles/oem/11g-compression-198295.html

  • Simple Query in Oracle Linked Table in MS Access causes full table scan.

    I am running a very simple query in MS ACCESS to a linked Oracle table as follows:
    Select *
    From EXPRESS_SERVICE_EVENTS --(the linked table name refers to EXPRESS.SERVICE_EVENTS)
    Where performed > MyDate()
    or
    Select *
    From EXPRESS_SERVICE_EVENTS --(the linked table name refers to EXPRESS.SERVICE_EVENTS)
    Where performed > [Forms]![MyForm]![Date1]
    We have over 50 machines and this query runs fine on over half of these, using an Oracle Index on the "performed" field. Running exactly the same thing on the other machines causes a full table scan, therefore ignoring the Index (all machines access the same Access DB).
    Strangely, if we write the query as follows:
    Select *
    From EXPRESS_SERVICE_EVENTS
    Where performed > #09/04/2009 08:00#
    it works fast everywhere!
    Any help on this 'phenominon' would be appreciated.
    Things we've done:
    Checked regional settings, ODBC driver settings, MS Access settings (as in Tools->Options), we have the latest XP and Office service packs, and re-linked all Access Tables on both the slow and fast machines independantly).

    Primarily, thanks gdarling for your reply. This solved our problem.
    Just a small note to those who may be using this thread.
    Although this might not be the reason, my PC had Oracle 9iR2 installed with Administratiev Tools, where user machines had the same thing installed but using Runtime Installation. For some reason, my PC did not have 'bind date' etc. as an option in the workarounds, but user machines did have this workaround option. Strangely, although I did not have the option, my (ODBC) query was running as expected, but user queries were not.
    When we set the workaround checkbox accordingly, the queries then run as expected (fast).
    Once again,
    Thanks

  • License for Table compression

    License is required in Oracle 11g for advanced compression.
    For oracle 10g table compression, is the license required?

    The licensing guide of Oracle 11.1 makes a distinction between:
    Oracle Advanced Compression --> extra cost option on top of EE
    Direct-Load Table Compression --> No extra cost option, but requires EE
    The admin guide says:
    To enable compression for all operations you must use the COMPRESS FOR ALL OPERATIONS clause. To enable compression for direct-path inserts only, you use the COMPRESS FOR DIRECT_LOAD OPERATIONS clause. The keyword COMPRESS by itself is the same as the clause COMPRESS FOR DIRECT_LOAD OPERATIONS, and invokes the same compression behavior as previous database releases.
    So if you stick to the old way of compressing data (direct load), it is less efficient than the new way (all operations), but it does not require the extra license.
    Geert De Paep

  • Loading an Oracle SQL query into an MSSQL table

    I have a select query on an Oracle table. I want to load this data into an MSSQL table.
    Problem is that I cannot create an interim table on the Oracle database (lack of privelages)
    Is there a way to load an Oracle query into the MSSQL table without an interim table?
    Many thanks
    Z

    Yes,
    1) Create an ODI procedure
    2) Create a step inside
    3) at source tab put the oracle query
    4) at target tab put the sql insert code
    Refer to the oracle returned values like "#column_name_from_oracle_query"
    Make sense?
    Cezar Santos
    [www.odiexperts.com]

  • Give me the sql query which calculte the table size in oracle 10g ecc 6.0

    Hi expert,
    Please  give me the sql query which calculte the table size in oracle 10g ecc 6.0.
    Regards

    Orkun Gedik wrote:
    select segment_name, sum(bytes)/(1024*1024) from dba_segments where segment_name = '<TABLE_NAME>' group by segment_name;
    Hi,
    This delivers possibly wrong data in MCOD installations.
    Depending on Oracle Version and Patchlevel dba_segments does not always have the correct data,
    at any time esp. for indexes right after being rebuild parallel (Even in DB02 because it is using USER_SEGMENTS).
    Takes a day to get the data back in line (never found out, who did the correction at night, could be RSCOLL00 ?).
    Use above statement with "OWNER = " in WHERE for MCOD or connect as schema owner and use USER_SEGMENTS.
    Use with
    segment_name LIKE '<TABLE_NAME>%'
    if you like to see the related indexes as well.
    For partitioned objects, a join from dba_tables / dba_indexes to dba_tab_partitions/dba_ind_partitions to dba_segments
    might be needed, esp. for hash partitioned tables, depending on how they have been created ( partition names SYS_xxxx).
    Volker

  • Like % in a query running on an Oracle Apps table with 8 million records

    I am running the below query. As per the explain plan it is using the index on organization_id and inventory_item_id.
    select segment1 from mtl_system_items where organization_id = 100 and inventory_item_id like '123456%'
    It takes about 15 min to run this query which is a long time as this query returns values to the frontend created in asp. The webpage would time out by the time this query completes running. do you have any suggestions on how to run this query faster?

    It is an oracle apps table. below is the structure -
    Name Null? Type
    INVENTORY_ITEM_ID NOT NULL NUMBER
    ORGANIZATION_ID NOT NULL NUMBER
    LAST_UPDATE_DATE NOT NULL DATE
    LAST_UPDATED_BY NOT NULL NUMBER
    CREATION_DATE NOT NULL DATE
    CREATED_BY NOT NULL NUMBER
    LAST_UPDATE_LOGIN NUMBER
    SUMMARY_FLAG NOT NULL VARCHAR2(1)
    ENABLED_FLAG NOT NULL VARCHAR2(1)
    START_DATE_ACTIVE DATE
    END_DATE_ACTIVE DATE
    DESCRIPTION VARCHAR2(240)
    BUYER_ID NUMBER(9)
    ACCOUNTING_RULE_ID NUMBER
    INVOICING_RULE_ID NUMBER
    SEGMENT1 VARCHAR2(40)
    SEGMENT2 VARCHAR2(40)
    SEGMENT3 VARCHAR2(40)
    SEGMENT4 VARCHAR2(40)
    SEGMENT5 VARCHAR2(40)
    SEGMENT6 VARCHAR2(40)
    SEGMENT7 VARCHAR2(40)
    SEGMENT8 VARCHAR2(40)
    SEGMENT9 VARCHAR2(40)
    SEGMENT10 VARCHAR2(40)
    SEGMENT11 VARCHAR2(40)
    SEGMENT12 VARCHAR2(40)
    SEGMENT13 VARCHAR2(40)
    SEGMENT14 VARCHAR2(40)
    SEGMENT15 VARCHAR2(40)
    SEGMENT16 VARCHAR2(40)
    SEGMENT17 VARCHAR2(40)
    SEGMENT18 VARCHAR2(40)
    SEGMENT19 VARCHAR2(40)
    SEGMENT20 VARCHAR2(40)
    ATTRIBUTE_CATEGORY VARCHAR2(30)
    ATTRIBUTE1 VARCHAR2(150)
    ATTRIBUTE2 VARCHAR2(150)
    ATTRIBUTE3 VARCHAR2(150)
    ATTRIBUTE4 VARCHAR2(150)
    ATTRIBUTE5 VARCHAR2(150)
    ATTRIBUTE6 VARCHAR2(150)
    ATTRIBUTE7 VARCHAR2(150)
    ATTRIBUTE8 VARCHAR2(150)
    ATTRIBUTE9 VARCHAR2(150)
    ATTRIBUTE10 VARCHAR2(150)
    ATTRIBUTE11 VARCHAR2(150)
    ATTRIBUTE12 VARCHAR2(150)
    ATTRIBUTE13 VARCHAR2(150)
    ATTRIBUTE14 VARCHAR2(150)
    ATTRIBUTE15 VARCHAR2(150)
    PURCHASING_ITEM_FLAG NOT NULL VARCHAR2(1)
    SHIPPABLE_ITEM_FLAG NOT NULL VARCHAR2(1)
    CUSTOMER_ORDER_FLAG NOT NULL VARCHAR2(1)
    INTERNAL_ORDER_FLAG NOT NULL VARCHAR2(1)
    SERVICE_ITEM_FLAG NOT NULL VARCHAR2(1)
    INVENTORY_ITEM_FLAG NOT NULL VARCHAR2(1)
    ENG_ITEM_FLAG NOT NULL VARCHAR2(1)
    INVENTORY_ASSET_FLAG NOT NULL VARCHAR2(1)
    PURCHASING_ENABLED_FLAG NOT NULL VARCHAR2(1)
    CUSTOMER_ORDER_ENABLED_FLAG NOT NULL VARCHAR2(1)
    INTERNAL_ORDER_ENABLED_FLAG NOT NULL VARCHAR2(1)
    SO_TRANSACTIONS_FLAG NOT NULL VARCHAR2(1)
    MTL_TRANSACTIONS_ENABLED_FLAG NOT NULL VARCHAR2(1)
    STOCK_ENABLED_FLAG NOT NULL VARCHAR2(1)
    BOM_ENABLED_FLAG NOT NULL VARCHAR2(1)
    BUILD_IN_WIP_FLAG NOT NULL VARCHAR2(1)
    REVISION_QTY_CONTROL_CODE NUMBER
    ITEM_CATALOG_GROUP_ID NUMBER
    CATALOG_STATUS_FLAG VARCHAR2(1)
    RETURNABLE_FLAG VARCHAR2(1)
    DEFAULT_SHIPPING_ORG NUMBER
    COLLATERAL_FLAG VARCHAR2(1)
    TAXABLE_FLAG VARCHAR2(1)
    QTY_RCV_EXCEPTION_CODE VARCHAR2(25)
    ALLOW_ITEM_DESC_UPDATE_FLAG VARCHAR2(1)
    INSPECTION_REQUIRED_FLAG VARCHAR2(1)
    RECEIPT_REQUIRED_FLAG VARCHAR2(1)
    MARKET_PRICE NUMBER
    HAZARD_CLASS_ID NUMBER
    RFQ_REQUIRED_FLAG VARCHAR2(1)
    QTY_RCV_TOLERANCE NUMBER
    LIST_PRICE_PER_UNIT NUMBER
    UN_NUMBER_ID NUMBER
    PRICE_TOLERANCE_PERCENT NUMBER
    ASSET_CATEGORY_ID NUMBER
    ROUNDING_FACTOR NUMBER
    UNIT_OF_ISSUE VARCHAR2(25)
    ENFORCE_SHIP_TO_LOCATION_CODE VARCHAR2(25)
    ALLOW_SUBSTITUTE_RECEIPTS_FLAG VARCHAR2(1)
    ALLOW_UNORDERED_RECEIPTS_FLAG VARCHAR2(1)
    ALLOW_EXPRESS_DELIVERY_FLAG VARCHAR2(1)
    DAYS_EARLY_RECEIPT_ALLOWED NUMBER
    DAYS_LATE_RECEIPT_ALLOWED NUMBER
    RECEIPT_DAYS_EXCEPTION_CODE VARCHAR2(25)
    RECEIVING_ROUTING_ID NUMBER
    INVOICE_CLOSE_TOLERANCE NUMBER
    RECEIVE_CLOSE_TOLERANCE NUMBER
    AUTO_LOT_ALPHA_PREFIX VARCHAR2(30)
    START_AUTO_LOT_NUMBER VARCHAR2(30)
    LOT_CONTROL_CODE NUMBER
    SHELF_LIFE_CODE NUMBER
    SHELF_LIFE_DAYS NUMBER
    SERIAL_NUMBER_CONTROL_CODE NUMBER
    START_AUTO_SERIAL_NUMBER VARCHAR2(30)
    AUTO_SERIAL_ALPHA_PREFIX VARCHAR2(30)
    SOURCE_TYPE NUMBER
    SOURCE_ORGANIZATION_ID NUMBER
    SOURCE_SUBINVENTORY VARCHAR2(10)
    EXPENSE_ACCOUNT NUMBER
    ENCUMBRANCE_ACCOUNT NUMBER
    RESTRICT_SUBINVENTORIES_CODE NUMBER
    UNIT_WEIGHT NUMBER
    WEIGHT_UOM_CODE VARCHAR2(3)
    VOLUME_UOM_CODE VARCHAR2(3)
    UNIT_VOLUME NUMBER
    RESTRICT_LOCATORS_CODE NUMBER
    LOCATION_CONTROL_CODE NUMBER
    SHRINKAGE_RATE NUMBER
    ACCEPTABLE_EARLY_DAYS NUMBER
    PLANNING_TIME_FENCE_CODE NUMBER
    DEMAND_TIME_FENCE_CODE NUMBER
    LEAD_TIME_LOT_SIZE NUMBER
    STD_LOT_SIZE NUMBER
    CUM_MANUFACTURING_LEAD_TIME NUMBER
    OVERRUN_PERCENTAGE NUMBER
    MRP_CALCULATE_ATP_FLAG VARCHAR2(1)
    ACCEPTABLE_RATE_INCREASE NUMBER
    ACCEPTABLE_RATE_DECREASE NUMBER
    CUMULATIVE_TOTAL_LEAD_TIME NUMBER
    PLANNING_TIME_FENCE_DAYS NUMBER
    DEMAND_TIME_FENCE_DAYS NUMBER
    END_ASSEMBLY_PEGGING_FLAG VARCHAR2(1)
    REPETITIVE_PLANNING_FLAG VARCHAR2(1)
    PLANNING_EXCEPTION_SET VARCHAR2(10)
    BOM_ITEM_TYPE NOT NULL NUMBER
    PICK_COMPONENTS_FLAG NOT NULL VARCHAR2(1)
    REPLENISH_TO_ORDER_FLAG NOT NULL VARCHAR2(1)
    BASE_ITEM_ID NUMBER
    ATP_COMPONENTS_FLAG NOT NULL VARCHAR2(1)
    ATP_FLAG NOT NULL VARCHAR2(1)
    FIXED_LEAD_TIME NUMBER
    VARIABLE_LEAD_TIME NUMBER
    WIP_SUPPLY_LOCATOR_ID NUMBER
    WIP_SUPPLY_TYPE NUMBER
    WIP_SUPPLY_SUBINVENTORY VARCHAR2(10)
    PRIMARY_UOM_CODE VARCHAR2(3)
    PRIMARY_UNIT_OF_MEASURE VARCHAR2(25)
    ALLOWED_UNITS_LOOKUP_CODE NUMBER
    COST_OF_SALES_ACCOUNT NUMBER
    SALES_ACCOUNT NUMBER
    DEFAULT_INCLUDE_IN_ROLLUP_FLAG VARCHAR2(1)
    INVENTORY_ITEM_STATUS_CODE VARCHAR2(10)
    INVENTORY_PLANNING_CODE NUMBER
    PLANNER_CODE VARCHAR2(10)
    PLANNING_MAKE_BUY_CODE NUMBER
    FIXED_LOT_MULTIPLIER NUMBER
    ROUNDING_CONTROL_TYPE NUMBER
    CARRYING_COST NUMBER
    POSTPROCESSING_LEAD_TIME NUMBER
    PREPROCESSING_LEAD_TIME NUMBER
    FULL_LEAD_TIME NUMBER
    ORDER_COST NUMBER
    MRP_SAFETY_STOCK_PERCENT NUMBER
    MRP_SAFETY_STOCK_CODE NUMBER
    MIN_MINMAX_QUANTITY NUMBER
    MAX_MINMAX_QUANTITY NUMBER
    MINIMUM_ORDER_QUANTITY NUMBER
    FIXED_ORDER_QUANTITY NUMBER
    FIXED_DAYS_SUPPLY NUMBER
    MAXIMUM_ORDER_QUANTITY NUMBER
    ATP_RULE_ID NUMBER
    PICKING_RULE_ID NUMBER
    RESERVABLE_TYPE NUMBER
    POSITIVE_MEASUREMENT_ERROR NUMBER
    NEGATIVE_MEASUREMENT_ERROR NUMBER
    ENGINEERING_ECN_CODE VARCHAR2(50)
    ENGINEERING_ITEM_ID NUMBER
    ENGINEERING_DATE DATE
    SERVICE_STARTING_DELAY NUMBER
    VENDOR_WARRANTY_FLAG NOT NULL VARCHAR2(1)
    SERVICEABLE_COMPONENT_FLAG VARCHAR2(1)
    SERVICEABLE_PRODUCT_FLAG NOT NULL VARCHAR2(1)
    BASE_WARRANTY_SERVICE_ID NUMBER
    PAYMENT_TERMS_ID NUMBER
    PREVENTIVE_MAINTENANCE_FLAG VARCHAR2(1)
    PRIMARY_SPECIALIST_ID NUMBER
    SECONDARY_SPECIALIST_ID NUMBER
    SERVICEABLE_ITEM_CLASS_ID NUMBER
    TIME_BILLABLE_FLAG VARCHAR2(1)
    MATERIAL_BILLABLE_FLAG VARCHAR2(30)
    EXPENSE_BILLABLE_FLAG VARCHAR2(1)
    PRORATE_SERVICE_FLAG VARCHAR2(1)
    COVERAGE_SCHEDULE_ID NUMBER
    SERVICE_DURATION_PERIOD_CODE VARCHAR2(10)
    SERVICE_DURATION NUMBER
    WARRANTY_VENDOR_ID NUMBER
    MAX_WARRANTY_AMOUNT NUMBER
    RESPONSE_TIME_PERIOD_CODE VARCHAR2(30)
    RESPONSE_TIME_VALUE NUMBER
    NEW_REVISION_CODE VARCHAR2(30)
    INVOICEABLE_ITEM_FLAG NOT NULL VARCHAR2(1)
    TAX_CODE VARCHAR2(50)
    INVOICE_ENABLED_FLAG NOT NULL VARCHAR2(1)
    MUST_USE_APPROVED_VENDOR_FLAG NOT NULL VARCHAR2(1)
    REQUEST_ID NUMBER
    PROGRAM_APPLICATION_ID NUMBER
    PROGRAM_ID NUMBER
    PROGRAM_UPDATE_DATE DATE
    OUTSIDE_OPERATION_FLAG NOT NULL VARCHAR2(1)
    OUTSIDE_OPERATION_UOM_TYPE VARCHAR2(25)
    SAFETY_STOCK_BUCKET_DAYS NUMBER
    AUTO_REDUCE_MPS NUMBER(22)
    COSTING_ENABLED_FLAG NOT NULL VARCHAR2(1)
    AUTO_CREATED_CONFIG_FLAG NOT NULL VARCHAR2(1)
    CYCLE_COUNT_ENABLED_FLAG NOT NULL VARCHAR2(1)
    ITEM_TYPE VARCHAR2(30)
    MODEL_CONFIG_CLAUSE_NAME VARCHAR2(10)
    SHIP_MODEL_COMPLETE_FLAG VARCHAR2(1)
    MRP_PLANNING_CODE NUMBER
    RETURN_INSPECTION_REQUIREMENT NUMBER
    ATO_FORECAST_CONTROL NUMBER
    RELEASE_TIME_FENCE_CODE NUMBER
    RELEASE_TIME_FENCE_DAYS NUMBER
    CONTAINER_ITEM_FLAG VARCHAR2(1)
    VEHICLE_ITEM_FLAG VARCHAR2(1)
    MAXIMUM_LOAD_WEIGHT NUMBER
    MINIMUM_FILL_PERCENT NUMBER
    CONTAINER_TYPE_CODE VARCHAR2(30)
    INTERNAL_VOLUME NUMBER
    WH_UPDATE_DATE DATE
    PRODUCT_FAMILY_ITEM_ID NUMBER
    GLOBAL_ATTRIBUTE_CATEGORY VARCHAR2(150)
    GLOBAL_ATTRIBUTE1 VARCHAR2(150)
    GLOBAL_ATTRIBUTE2 VARCHAR2(150)
    GLOBAL_ATTRIBUTE3 VARCHAR2(150)
    GLOBAL_ATTRIBUTE4 VARCHAR2(150)
    GLOBAL_ATTRIBUTE5 VARCHAR2(150)
    GLOBAL_ATTRIBUTE6 VARCHAR2(150)
    GLOBAL_ATTRIBUTE7 VARCHAR2(150)
    GLOBAL_ATTRIBUTE8 VARCHAR2(150)
    GLOBAL_ATTRIBUTE9 VARCHAR2(150)
    GLOBAL_ATTRIBUTE10 VARCHAR2(150)
    PURCHASING_TAX_CODE VARCHAR2(50)
    The query is as below
    select segment1 from mtl_system_items where organization_id = 100 and inventory_item_id like '123456%'
    The explain plan is as below -
    Plan
    SELECT STATEMENT RULE          
         2 TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS      
              1 INDEX RANGE SCAN NON-UNIQUE INV.MTL_SYSTEM_ITEMS_N1
    The INV.MTL_SYSTEM_ITEMS_N1 index is created on
    ORGANIZATION_ID and SEGMENT1

  • Oracle table compression

    Can you please explain - how oracle compression works - It would be really good if things will be explained with examples - also would be very use if you post some useful links ...
    Will there be any performace problems if the table is compressed ..

    BelMan wrote:
    Table compression was designed primarily for read-only environments and can cause processing overhead for DML operations in some cases. However, it increases performance for many read operations, especially when your system is I/O bound
    http://download.oracle.com/docs/cd/B13789_01/server.101/b10752/build_db.htm
    Not necessarily true. Envision a table where you have 7 years worth of data (say for auditing purposes) partitioned monthly with only the current month being actively DML'd, the rest are for all intents and purposes read only and compressed.
    Table compression was designed to be designed with :)

  • Query in timesten taking more time than query in oracle database

    Hi,
    Can anyone please explain me why query in timesten taking more time
    than query in oracle database.
    I am mentioning in detail what are my settings and what have I done
    step by step.........
    1.This is the table I created in Oracle datababase
    (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
    CREATE TABLE student (
    id NUMBER(9) primary keY ,
    first_name VARCHAR2(10),
    last_name VARCHAR2(10)
    2.THIS IS THE ANONYMOUS BLOCK I USE TO
    POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
    declare
    firstname varchar2(12);
    lastname varchar2(12);
    catt number(9);
    begin
    for cntr in 1..2599999 loop
    firstname:=(cntr+8)||'f';
    lastname:=(cntr+2)||'l';
    if cntr like '%9999' then
    dbms_output.put_line(cntr);
    end if;
    insert into student values(cntr,firstname, lastname);
    end loop;
    end;
    3. MY DSN IS SET THE FOLLWING WAY..
    DATA STORE PATH- G:\dipesh3repo\db
    LOG DIRECTORY- G:\dipesh3repo\log
    PERM DATA SIZE-1000
    TEMP DATA SIZE-1000
    MY TIMESTEN VERSION-
    C:\Documents and Settings\dipesh>ttversion
    TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
    Instance admin: dipesh
    Instance home directory: G:\TimestTen\TT70_32
    Daemon home directory: G:\TimestTen\TT70_32\srv\info
    THEN I CONNECT TO THE TIMESTEN DATABASE
    C:\Documents and Settings\dipesh> ttisql
    command>connect "dsn=dipesh3;oraclepwd=tiger";
    4. THEN I START THE AGENT
    call ttCacheUidPwdSet('SCOTT','TIGER');
    Command> CALL ttCacheStart();
    5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
    create readonly cache group rc_student autorefresh
    interval 5 seconds from student
    (id int not null primary key, first_name varchar2(10), last_name varchar2(10));
    load cache group rc_student commit every 100 rows;
    6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
    I SET THE TIMING..
    command>TIMING 1;
    consider this query now..
    Command> select * from student where first_name='2155666f';
    < 2155658, 2155666f, 2155660l >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
    another query-
    Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
    2206: Table SCOTT.STUDENTS not found
    Execution time (SQLPrepare) = 0.074964 seconds.
    The command failed.
    Command> SELECT * FROM STUDENT where first_name='2093434f';
    < 2093426, 2093434f, 2093428l >
    1 row found.
    Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
    Command>
    7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
    SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
    ID FIRST_NAME LAST_NAME
    1498663 1498671f 1498665l
    Elapsed: 00:00:00.15
    Can anyone please explain me why query in timesten taking more time
    that query in oracle database.
    Message was edited by: Dipesh Majumdar
    user542575
    Message was edited by:
    user542575

    TimesTen
    Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
    Version: 7.0.4.0.0 64 bit
    Schema:
    create usermanaged cache group factCache from
    MV_US_DATAMART
    ORDER_DATE               DATE,
    IF_SYSTEM               VARCHAR2(32) NOT NULL,
    GROUPING_ID                TT_BIGINT,
    TIME_DIM_ID               TT_INTEGER NOT NULL,
    BUSINESS_DIM_ID          TT_INTEGER NOT NULL,
    ACCOUNT_DIM_ID               TT_INTEGER NOT NULL,
    ORDERTYPE_DIM_ID          TT_INTEGER NOT NULL,
    INSTR_DIM_ID               TT_INTEGER NOT NULL,
    EXECUTION_DIM_ID          TT_INTEGER NOT NULL,
    EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
    NO_ORDERS               TT_BIGINT,
    FILLED_QUANTITY          TT_BIGINT,
    CNT_FILLED_QUANTITY          TT_BIGINT,
    QUANTITY               TT_BIGINT,
    CNT_QUANTITY               TT_BIGINT,
    COMMISSION               BINARY_FLOAT,
    CNT_COMMISSION               TT_BIGINT,
    FILLS_NUMBER               TT_BIGINT,
    CNT_FILLS_NUMBER          TT_BIGINT,
    AGGRESSIVE_FILLS          TT_BIGINT,
    CNT_AGGRESSIVE_FILLS          TT_BIGINT,
    NOTIONAL               BINARY_FLOAT,
    CNT_NOTIONAL               TT_BIGINT,
    TOTAL_PRICE               BINARY_FLOAT,
    CNT_TOTAL_PRICE          TT_BIGINT,
    CANCELLED_ORDERS_COUNT          TT_BIGINT,
    CNT_CANCELLED_ORDERS_COUNT     TT_BIGINT,
    ROUTED_ORDERS_NO          TT_BIGINT,
    CNT_ROUTED_ORDERS_NO          TT_BIGINT,
    ROUTED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_ROUTED_LIQUIDITY_QTY     TT_BIGINT,
    REMOVED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_REMOVED_LIQUIDITY_QTY     TT_BIGINT,
    ADDED_LIQUIDITY_QTY          TT_BIGINT,
    CNT_ADDED_LIQUIDITY_QTY     TT_BIGINT,
    AGENT_CHARGES               BINARY_FLOAT,
    CNT_AGENT_CHARGES          TT_BIGINT,
    CLEARING_CHARGES          BINARY_FLOAT,
    CNT_CLEARING_CHARGES          TT_BIGINT,
    EXECUTION_CHARGES          BINARY_FLOAT,
    CNT_EXECUTION_CHARGES          TT_BIGINT,
    TRANSACTION_CHARGES          BINARY_FLOAT,
    CNT_TRANSACTION_CHARGES     TT_BIGINT,
    ORDER_MANAGEMENT          BINARY_FLOAT,
    CNT_ORDER_MANAGEMENT          TT_BIGINT,
    SETTLEMENT_CHARGES          BINARY_FLOAT,
    CNT_SETTLEMENT_CHARGES          TT_BIGINT,
    RECOVERED_AGENT          BINARY_FLOAT,
    CNT_RECOVERED_AGENT          TT_BIGINT,
    RECOVERED_CLEARING          BINARY_FLOAT,
    CNT_RECOVERED_CLEARING          TT_BIGINT,
    RECOVERED_EXECUTION          BINARY_FLOAT,
    CNT_RECOVERED_EXECUTION     TT_BIGINT,
    RECOVERED_TRANSACTION          BINARY_FLOAT,
    CNT_RECOVERED_TRANSACTION     TT_BIGINT,
    RECOVERED_ORD_MGT          BINARY_FLOAT,
    CNT_RECOVERED_ORD_MGT          TT_BIGINT,
    RECOVERED_SETTLEMENT          BINARY_FLOAT,
    CNT_RECOVERED_SETTLEMENT     TT_BIGINT,
    CLIENT_AGENT               BINARY_FLOAT,
    CNT_CLIENT_AGENT          TT_BIGINT,
    CLIENT_ORDER_MGT          BINARY_FLOAT,
    CNT_CLIENT_ORDER_MGT          TT_BIGINT,
    CLIENT_EXEC               BINARY_FLOAT,
    CNT_CLIENT_EXEC          TT_BIGINT,
    CLIENT_TRANS               BINARY_FLOAT,
    CNT_CLIENT_TRANS          TT_BIGINT,
    CLIENT_CLEARING          BINARY_FLOAT,
    CNT_CLIENT_CLEARING          TT_BIGINT,
    CLIENT_SETTLE               BINARY_FLOAT,
    CNT_CLIENT_SETTLE          TT_BIGINT,
    CHARGEABLE_TAXES          BINARY_FLOAT,
    CNT_CHARGEABLE_TAXES          TT_BIGINT,
    VENDOR_CHARGE               BINARY_FLOAT,
    CNT_VENDOR_CHARGE          TT_BIGINT,
    ROUTING_CHARGES          BINARY_FLOAT,
    CNT_ROUTING_CHARGES          TT_BIGINT,
    RECOVERED_ROUTING          BINARY_FLOAT,
    CNT_RECOVERED_ROUTING          TT_BIGINT,
    CLIENT_ROUTING               BINARY_FLOAT,
    CNT_CLIENT_ROUTING          TT_BIGINT,
    TICKET_CHARGES               BINARY_FLOAT,
    CNT_TICKET_CHARGES          TT_BIGINT,
    RECOVERED_TICKET_CHARGES     BINARY_FLOAT,
    CNT_RECOVERED_TICKET_CHARGES     TT_BIGINT,
    PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
    READONLY);
    No of rows: 2228558
    Config:
    < CkptFrequency, 600 >
    < CkptLogVolume, 0 >
    < CkptRate, 0 >
    < ConnectionCharacterSet, US7ASCII >
    < ConnectionName, tt_us_dma >
    < Connections, 64 >
    < DataBaseCharacterSet, AL32UTF8 >
    < DataStore, e:\andrew\datacache\usDMA >
    < DurableCommits, 0 >
    < GroupRestrict, <NULL> >
    < LockLevel, 0 >
    < LockWait, 10 >
    < LogBuffSize, 65536 >
    < LogDir, e:\andrew\datacache\ >
    < LogFileSize, 64 >
    < LogFlushMethod, 1 >
    < LogPurge, 0 >
    < Logging, 1 >
    < MemoryLock, 0 >
    < NLS_LENGTH_SEMANTICS, BYTE >
    < NLS_NCHAR_CONV_EXCP, 0 >
    < NLS_SORT, BINARY >
    < OracleID, NYCATP1 >
    < PassThrough, 0 >
    < PermSize, 4000 >
    < PermWarnThreshold, 90 >
    < PrivateCommands, 0 >
    < Preallocate, 0 >
    < QueryThreshold, 0 >
    < RACCallback, 0 >
    < SQLQueryTimeout, 0 >
    < TempSize, 514 >
    < TempWarnThreshold, 90 >
    < Temporary, 1 >
    < TransparentLoad, 0 >
    < TypeMode, 0 >
    < UID, OS_OWNER >
    ORACLE:
    Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
    Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    Schema:
    CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
    TABLESPACE TS_OS
    PARTITION BY RANGE (ORDER_DATE)
    PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS,
    PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
    LOGGING
    NOCOMPRESS
    TABLESPACE TS_OS
    NOCACHE
    NOCOMPRESS
    NOPARALLEL
    BUILD DEFERRED
    USING INDEX
    TABLESPACE TS_OS_INDEX
    REFRESH FAST ON DEMAND
    WITH PRIMARY KEY
    ENABLE QUERY REWRITE
    AS
    SELECT order_date, if_system,
    GROUPING_ID (order_date,
    if_system,
    business_dim_id,
    time_dim_id,
    account_dim_id,
    ordertype_dim_id,
    instr_dim_id,
    execution_dim_id,
    exec_exchange_dim_id
    ) GROUPING_ID,
    /* ============ DIMENSIONS ============ */
    time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
    instr_dim_id, execution_dim_id, exec_exchange_dim_id,
    /* ============ MEASURES ============ */
    -- o.FX_RATE /* FX_RATE */,
    COUNT (*) no_orders,
    -- SUM(NO_ORDERS) NO_ORDERS,
    -- COUNT(NO_ORDERS) CNT_NO_ORDERS,
    SUM (filled_quantity) filled_quantity,
    COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
    COUNT (quantity) cnt_quantity, SUM (commission) commission,
    COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
    COUNT (fills_number) cnt_fills_number,
    SUM (aggressive_fills) aggressive_fills,
    COUNT (aggressive_fills) cnt_aggressive_fills,
    SUM (fx_rate * filled_quantity * average_price) notional,
    COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
    SUM (fx_rate * fills_number * average_price) total_price,
    COUNT (fx_rate * fills_number * average_price) cnt_total_price,
    SUM (CASE
    WHEN order_status = 'C'
    THEN 1
    ELSE 0
    END) cancelled_orders_count,
    COUNT (CASE
    WHEN order_status = 'C'
    THEN 1
    ELSE 0
    END
    ) cnt_cancelled_orders_count,
    -- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
    -- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
    -- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
    SUM (routed_orders_no) routed_orders_no,
    COUNT (routed_orders_no) cnt_routed_orders_no,
    SUM (routed_liquidity_qty) routed_liquidity_qty,
    COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
    SUM (removed_liquidity_qty) removed_liquidity_qty,
    COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
    SUM (added_liquidity_qty) added_liquidity_qty,
    COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
    SUM (agent_charges) agent_charges,
    COUNT (agent_charges) cnt_agent_charges,
    SUM (clearing_charges) clearing_charges,
    COUNT (clearing_charges) cnt_clearing_charges,
    SUM (execution_charges) execution_charges,
    COUNT (execution_charges) cnt_execution_charges,
    SUM (transaction_charges) transaction_charges,
    COUNT (transaction_charges) cnt_transaction_charges,
    SUM (order_management) order_management,
    COUNT (order_management) cnt_order_management,
    SUM (settlement_charges) settlement_charges,
    COUNT (settlement_charges) cnt_settlement_charges,
    SUM (recovered_agent) recovered_agent,
    COUNT (recovered_agent) cnt_recovered_agent,
    SUM (recovered_clearing) recovered_clearing,
    COUNT (recovered_clearing) cnt_recovered_clearing,
    SUM (recovered_execution) recovered_execution,
    COUNT (recovered_execution) cnt_recovered_execution,
    SUM (recovered_transaction) recovered_transaction,
    COUNT (recovered_transaction) cnt_recovered_transaction,
    SUM (recovered_ord_mgt) recovered_ord_mgt,
    COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
    SUM (recovered_settlement) recovered_settlement,
    COUNT (recovered_settlement) cnt_recovered_settlement,
    SUM (client_agent) client_agent,
    COUNT (client_agent) cnt_client_agent,
    SUM (client_order_mgt) client_order_mgt,
    COUNT (client_order_mgt) cnt_client_order_mgt,
    SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
    SUM (client_trans) client_trans,
    COUNT (client_trans) cnt_client_trans,
    SUM (client_clearing) client_clearing,
    COUNT (client_clearing) cnt_client_clearing,
    SUM (client_settle) client_settle,
    COUNT (client_settle) cnt_client_settle,
    SUM (chargeable_taxes) chargeable_taxes,
    COUNT (chargeable_taxes) cnt_chargeable_taxes,
    SUM (vendor_charge) vendor_charge,
    COUNT (vendor_charge) cnt_vendor_charge,
    SUM (routing_charges) routing_charges,
    COUNT (routing_charges) cnt_routing_charges,
    SUM (recovered_routing) recovered_routing,
    COUNT (recovered_routing) cnt_recovered_routing,
    SUM (client_routing) client_routing,
    COUNT (client_routing) cnt_client_routing,
    SUM (ticket_charges) ticket_charges,
    COUNT (ticket_charges) cnt_ticket_charges,
    SUM (recovered_ticket_charges) recovered_ticket_charges,
    COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
    FROM us_datamart_raw
    GROUP BY order_date,
    if_system,
    business_dim_id,
    time_dim_id,
    account_dim_id,
    ordertype_dim_id,
    instr_dim_id,
    execution_dim_id,
    exec_exchange_dim_id;
    -- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
    -- by Oracle with the associated materialized view.
    CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
    (ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
    INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
    NOLOGGING
    NOPARALLEL
    COMPRESS 7;
    No of rows: 2228558
    The query (taken Mondrian) I run against each of them is:
    select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
    --, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
    --, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
    --, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
    --, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
    --, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
    --, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
    --, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
    --, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
    --, sum("MV_US_DATAMART"."COMMISSION") as "m9"
    --, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
    --, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
    --,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
    --,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
    --, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
    --, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
    --, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
    --, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
    --,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
    --, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
              from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
    where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
    No Columns     ORACLE     TimesTen     
    1     1.05     0.94     
    2     1.07     1.47     
    3     2.04     1.8     
    4     2.06     2.08     
    5     2.09     2.4     
    6     3.01     2.67     
    7     4.02     3.06     
    8     4.03     3.37     
    9     4.04     3.62     
    10     4.06     4.02     
    11     4.08     4.31     
    12     4.09     4.61     
    13     5.01     4.76     
    14     5.02     5.06     
    15     5.04     5.25     
    16     5.05     5.48     
    17     5.08     5.84     
    18     6     6.21     
    19     6.02     6.34     
    20     6.04     6.75

  • Using case when statement in the select query to create physical table

    Hello,
    I have a requirement where in I have to execute a case when statement with a session variable while creating a physical table using a select query. let me explain with an example.
    I have a physical table based on a select table with one column.
    SELECT 'VALUEOF(NQ_SESSION.NAME_PARAMETER)' AS NAME_PARAMETER FROM DUAL. Let me call this table as the NAME_PARAMETER table.
    I also have a customer table.
    In my dashboard that has two pages, Page 1 contains a table with the customer table with column navigation to my second dashboard page.
    In my second dashboard page I created a dashboard report based on NAME_PARAMETER table and a prompt based on customer table that sets the NAME_ PARAMETER request variable.
    EXECUTION
    When i click on a particular customer, the prompt sets the variable NAME_PARAMETER and the NAME_PARAMETER table shows the appropriate customer.
    everything works as expected. YE!!
    Now i created another table called NAME_PARAMETER1 with a little modification to the earlier table. the query is as follows.
    SELECT CASE WHEN 'VALUEOF(NQ_SESSION.NAME_PARAMETER)'='Customer 1' THEN 'TEST_MART1' ELSE TEST_MART2' END AS NAME_PARAMETER
    FROM DUAL
    Now I pull in this table into the second dashboard page along with the NAME_PARAMETER table report.
    surprisingly, NAME_PARAMETER table report executes as is, but the other report based on the NAME_PARAMETER1 table fails with the following error.
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1756 message: [Oracle][ODBC][Ora]ORA-01756: quoted string not properly terminated. [nQSError: 16014] SQL statement preparation failed. (HY000)
    SQL Issued: SET VARIABLE NAME_PARAMETER='Novartis';SELECT NAME_PARAMETER.NAME_PARAMETER saw_0 FROM POC_ONE_DOT_TWO ORDER BY saw_0
    If anyone has any explanation to this error and how we can achieve the same, please help.
    Thanks.

    Hello,
    Updates :) sorry.. the error was a stupid one.. I resolved and I got stuck at my next step.
    I am creating a physical table using a select query. But I am trying to obtain the name of the table dynamically.
    Here is what I am trying to do. the select query of the physical table is as follows.
    SELECT CUSTOMER_ID AS CUSTOMER_ID, CUSTOMER_NAME AS CUSTOMER_NAME FROM 'VALUEOF(NQ_SESSION.SCHEMA_NAME)'.CUSTOMER.
    The idea behind this is to obtain the data from the same table from different schemas dynamically based on what a session variable. Please let me know if there is a way to achieve this, if not please let me know if this can be achieved in any other method in OBIEE.
    Thanks.

  • Problem with different resultset with same data and same query in Oracle 8.1.7 and 9i

    Hello,
    I have been using this query in oracle 8.1.7
    SELECT
    ID,
    AREA_NO
    FROM MANAGER_AREA MGR
    WHERE COMPANY_ID = :id AND
    (:value < (SELECT COUNT(ROWID)
    FROM MANAGER_WORK MW
    WHERE MW.AREA_ID = MGR.ID AND
    (MW.END_WORK IS NULL OR MW.END_WORK >= SYSDATE)))
    order by AREA_NO;
    In the above query I want to see rows from MANAGER_AREA table depending upon date criteria in the table MANAGER_WORK and also upon the parameter :value i.e if I pass a value as 0 I get to see records for which their is atleast 1 record in MANAGER_WORK with the date criteria and if I pass -1 then I get all the records because minimum value that count(*) would give is 0. The resultset was as expected in 8.1.7.
    A couple of days back I installed PERSONAL 9i to test for testing the basic functionality of our program with the same data. This query fails and irrespective whether I pass -1 or 0 it returns me same dataset which I would have got in case if I pass 0.
    I do not know whether this is a bug that has got introduced in 9i. Can anybody help me with this problem. It would be difficult for me to change the parameter send to this query as the Query is called from many different places.
    Thanks in advance
    Amol.

    I cannot use a Group by and a having statement over here. The problem with 'Group by' and 'having' clause is If I have to make a join between the two tables. When I use join then I get only rows that are linked to each other in the table.
    If I use outer join to solve that problem then I have to take in consideration the other date condition. My previous query use to virtually discard the corelated query result by using -1 as the value. This will not happen in the join query.
    Amol.

  • How to write REF-CURSOR Query in Oracle Reports

    Hello Guys!!
    I have a form in which you can select regions/divisions/locations etc by the use of check boxes. And the selected values will be inserted into a table, and based on the selected values of the table the report is run.
    The issue I have is with the query inside the Oracle reports(attached to this file).
    The query works fine until the last two EXISTS conditions.
    IF a region exists In the table report_param then it works fine but if there are no divisions in it , then the query returns no values, which is not correct.
    Someone has advised me to use a ref-cursor query inside reports tool, which I am not aware off. So, anykind of suggestions or advises are welcome. Please let me know about it as it is very urgent issue for me. Anykind of help would be greatly
    appreciated.
    Thanks,
    Vishal
    -------------------------------------------------------Query in Oracle Reports---------------------------------------------------------
    select c.key_segment, p.supplier_id,
    decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>')) COL_NM,
    sum(a.ext_price) sales_dols,
    sum(comp_allow_pkg.get_comp_allow_stddiv(a.control_loc_id, a.product_id, a.sold_to_customer_id,
    a.doc_dt, a.ext_price, a.units)) cust_reb_dols,
    sum(a.units) units,
    sum(a.ext_cost) cost_dols
    from sales a, key_segment_plns c, product p, rep_wrtr_dw_cust h
    where a.doc_dt between :in_start_dt and :in_end_dt
    and a.customer_oc = h.control_loc_id
    and a.sold_to_customer_id = h.sold_to_cust_id
    and a.ship_to_customer_id = h.ship_to_cust_id
    and ((:in_dg_cd = 'B' and h.dealer_grower_cd in ('D','G')) or h.dealer_grower_cd = :in_dg_cd)
    and a.product_id = p.product_id
    and p.product_gl_class_cd = 'CHEM'
    and p.product_legal_name = c.product_legal_name
    and c.key_segment in ('GLYPHOSATE','PLANT HEALTH/RUST FUNGICIDES','PYRETHROIDS','STROBI FUNGICIDES')--&IN_KEY_SEGMENTS
    -- and (:in_oc = 'ALL' or (a.control_loc_id in (select control_loc from control_loc_comb_ocs where control_loc_comb = :in_oc)))
    -- SALES DATA FILTERS TO MATCH ACCUM_SALES_DG_MV
    and a.sale_type_cd in ('02','08')
    and a.document_type_cd in ('I','C','D')
    and (substr(a.product_id,-1) in ('0','1') OR nvl(upper(trim(p.product_brand)),'X') = 'TECH FEE')
    and a.units <> 0
    and a.unit_cost <> 0
    and a.unit_price <> 0
    -- NEW FILTERS ADDED 9/11/07: LOCATION(BRANCH), BUSINESS TYPE, RSM/ASM/REP
    and ((:in_loc = 'ALL') or (nvl(a.warehouse_id,'<blank>') in (SELECT param_value
    FROM report_param
    WHERE report_id = :IN_REPORT_ID
    AND session_id= :IN_SESSION_ID
    AND USER_ID = :IN_USER_ID
    AND param_name='LOCATION_TYPE')))
    and ((:in_uhs_ag = 'ALL') or (:in_uhs_ag = 'NA' and p.product_uhs_ag != 'A') or (p.product_uhs_ag = :in_uhs_ag))
    and ((:in_sales_rep = 'ALL') or (nvl(a.territory_id,'<blank>') in (SELECT param_value
    FROM report_param
    WHERE report_id = :IN_REPORT_ID
    AND session_id= :IN_SESSION_ID
    AND USER_ID = :IN_USER_ID
    AND param_name='SALES_REP_TYPE')))
    and EXISTS
    (SELECT '1'
    FROM locations l, report_param rp
    WHERE rp.report_id = :IN_REPORT_ID
    AND rp.session_id= :IN_SESSION_ID
    AND rp.user_id = :IN_USER_ID
    AND rp.param_value = l.region
    AND rp.param_name = 'REGION_TYPE'
    AND a.warehouse_id = L.ARS_LOCATION)
    and EXISTS
    (SELECT '1'
    FROM locations l, report_param rp
    WHERE rp.report_id = :IN_REPORT_ID
    AND rp.session_id= :IN_SESSION_ID
    AND rp.user_id = :IN_USER_ID
    AND rp.param_value = l.region
    AND rp.param_name = 'DIVISION_TYPE'
    AND a.warehouse_id = L.ARS_LOCATION)
    group by c.key_segment, P.supplier_id,
    decode(:in_col_nm, 'BRAND',nvl(p.product_brand,'<Unknown Brand>'), 'PLN',nvl(p.product_legal_name,'<Unknown Legal Name>'))

    Hi,
    I need your help to create a report using Ref-Cursor. please see the below thread
    Report using ref cursor or dynamic Sql

  • Crosstab Query in Oracle

    Dear members:
    I have been trying to generate a crosstab query in Oracle using SQL.
    This is the situation:
    I have two tables in Oracle. One contains characteristics of institutions which people visit, and includes, amongst other fields, the ID of the institution (number) and an identificator for the district where the institution is implanted (number; ranging 1 - 18).
    The second table also contains a field with the ID of the institution, and more: the date when the visit occured (date), and a sequential (unique) number for each visit.
    What I need to obtain is a final table containing the following fields:
    Date of the visit, total number of visitors per date of visit, and a field for each district containing the total number of visitors to instituitions of the district per each date of visit.
    Can anyone give me a hint on this?
    Also; is there a user-frindly interface minimizing the use of SQL that I can download from Oracle for generating this?
    Thank You
    André

    Crosstab is a reporting function not a SQL one. SQL statements must have a fixed number of columns regardless of the data.
    The only way to do it using SQL is to use PL/SQL to generate a dynamic query as shown on Ask Tom here
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:15151874723724
    Otherwise there are reporting tools such as Oracle Reports that can do it as well.

Maybe you are looking for

  • Trying to download an app onto my iphone, but the screen is grey (not connected) so won't download.  Any ideas? Tks

    Trying to download an app, from my computer, onto iphone, but it is grey (not connected) so won't download.  Any ideas? Tks

  • Unable to order book in iPhoto iOS

    Hi, I have created a book in iOS iPhoto but can not seem to place the order. Basically after adding the address (which matches the country selected in the iPhoto Store, i.e., Spain) it begins processing and after asking to sign in to my iTunes accoun

  • Help, Crashing iPad 3.

    My iPad 3 keeps crashing.  This started June 26, 2014 and has happened everyday when using any app, even apps that come on the iPad.   I have done multiple hard resets, turned it on and off several times, restored to new iPad 4 times and it keeps hap

  • Regex question

    Hi, I have a question regarding the regular expressions in java. Let's say I have the following regex: "(one)|(two)|(three)" and the following string: "two". The string obviously matches the regex, because of the "\2" group. Is there any way to deter

  • Burn a slide show

    How can I burn a slide show to a DVD playable on a DVD palyer and a TV?