Oracle evolution suggestion : NULL and Index

Hello,
As you know in most of case NULL values are not indexed and then not searchable using index.
Then when you do where MyField is null, you have the risk of doing a full table scan
However most of people don't know that, and then doesn't care of this possible issue and of possible solution (bitmap or including a not null column)
SQL Server, MySQL and probably some others DB don't have the same behavior as they indexes NULL
I know this caveat can be used to have partial indexing by nulling non interesting values and then can't be removed
Then I would suggest to enhance the create index command to allow to index also null with something like that
Create index MyIndex on MyTable(MyColumn including nulls )
As you make this change, perhaps it would be geat to change the behavior documented bellow as it looks more as an old heritage too by adding keyword like "allow null duplicate" and "constraint on null duplicate"
Ascending unique indexes allow multiple NULL values. However, in descending unique indexes, multiple NULL values are treated as duplicate values and therefore are not permitted.
Laurent

Hello,
Thanks, for the links it cover mains solutions to index null values, there's also the usage of bitmap index.
All of them are not very intuitive for an non expert.
But the purpose of my message was mainly to higlight this complexity for a quite basic stuff, as I think that the default solution should be to index nulls and eventually allow to do not index them.
As I said this is the behavior on sql server and mysql. That why i suggest to enhance index behavior to allow to index nulls easily and not by using stange tips like indexing a blank space or a not null column.
This solutions are from my viewpoint workaround, helpfull workaround but still workaround, Oracle database team have the power to change this root cause without breaking ascending compatibility, here is the sense of my message, just hopping they can hear me...
Laurent

Similar Messages

  • Null and Empty Values

    Hi All,
    Is there a parameter which allows me to translate automatically the instruction
    select * from table_a where col_a = ''
    in
    select * from table_a where col_a is null
    Thanks

    Not in Oracle, no. col_a = NULL and col_a IS NULL are logically distinct clauses. If you are dealing with NULL's, you absolutely must use three-valued logic in your statements.
    Depending on what you are doing, you may be able to throw an NVL on col_a to ensure a non-NULL value is returned.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Compression for oracle database and index compression during import of data

    Hi All,
    I have a query , in order to import into oracle database and also have compression and index compression , do we have some kind of load args for r3load and also do we have to change the tpl file ?

    Hello guy,
    I did this kind of compression within migration project before.
    I performed index compress first and then export -> import with table compress.
    One thing you should take care, delete nocompress flag from TARGET.SQL (created by program SMIGR_CREATE_DDL, program SMIGR_CREATE_DDL created pure non-compression objects for these considered non-standard tables). For table columns > 255, we should not delete this flag.
    Regarding to the index compress in source system, please check the following notes:
    Note 1464156 - Support for index compression in BRSPACE 7.20
    Note 1109743 - Use of Index Key Compression for Oracle Databases
    Note 682926 - Composite SAP note: Problems with "create/rebuild index"
    Best Regards,
    Ning Tong

  • Oracle export/import and indexing

    Hello All,
    I am a newbie in oracle filed and trying to understand export/import funtionality and indexing related to it. May be it's silly but I don't get any other way to understand it.
    Below are the topics I tried to understand-
    1) I export one Db and trying to import that in another database server. I used sysdba username to import. A new table space will get created or how the data will store in database what would be the effect in indexing with this export and import.
    2) If i import one more db on the same database server using sysdba username then also how indexing will behave?
    Please help me to understand
    Thanks
    Sayan
    Edited by: Sayan_Roy on Sep 26, 2011 11:41 PM

    Indexes are tied to tables. The default behaviour, in the absence of you specifying any directives, is that Oracle runs
    CREATE TABLE
    INSERT INTO table
    CREATE INDEX
    So, the Indexes are created after each of the corresponding tables.
    Do NOT ever attempt to export/import objects owned by SYSDBA. You should be creating a separate schema to hold all your objects (Tables, Indexes, Views, Procedures, Functions etc). That separate schema can be exported and imported into another database. If you have multiple such schemas, a Full Export Import will copy all the schemas.
    If a schema preexists in the target database, the import will error when attempting to CREATE TABLE --- unless you specify directives to handle this.
    Please read the documentation on Export and Import for the version that you are testing.
    Hemant K Chitale

  • Scanning and indexing option not appear in Oracle Document capture

    Hi
    I installed Oracle document capture 10.1.3.5.1.
    when i opened this document capture scanning and indexing option are not presented.
    i am using windows 64 bit operating system.
    please find screenshot for the same
    [http://oraclebpm.com/webcenter/scanning_indexing.png]

    Thank you Ryan for your reply. The problem was resolved.
    First I downloaded document capture s/w from oracle.com site,I am not getting the option when I download s/w from this site.
    Later i downloaded it from https://edelivery.oracle.com/ site. Now I am getting the options now.
    -vishnu

  • How oracle decide whetehr to use index or full scan (statistics)

    Hi Guys,
    Let say i have a index on a column.
    The table and index statistics has been gathered. (without histograms).
    Let say i perform a select * from table where a=5;
    Oracle will perform a full scan.
    But from which statistics it will be able to know indeed most of the column = 5? (histograms not used)
    After analyzing, we get the below:
    Table Statistics :
    (NUM_ROWS)
    (BLOCKS)
    (EMPTY_BLOCKS)
    (AVG_SPACE)
    (CHAIN_COUNT)
    (AVG_ROW_LEN)
    Index Statistics :
    (BLEVEL)
    (LEAF_BLOCKS)
    (DISTINCT_KEYS)
    (AVG_LEAF_BLOCKS_PER_KEY)
    (AVG_DATA_BLOCKS_PER_KEY)
    (CLUSTERING_FACTOR)
    thanks
    Index Column (A)
    ======
    1
    1
    2
    2
    5
    5
    5
    5
    5
    5

    I have prepared some explanation and have not noticed that the topic has been marked as answered.
    This my sentence is not completely true.
    A column "without histograms" means that the column has only one bucket. More correct: even without histograms there are data in dba_tab_histograms which we can consider as one bucket for whole column. In fact these data are retrieved from hist_head$, not from histgrm$ as usual buckets.
    Technically there is no any buckets without gathered histograms.
    Let's create a table with skewed data distribution.
    SQL> create table t as
      2  select least(rownum,3) as val, '*' as pad
      3    from dual
      4  connect by level <= 1000000;
    Table created
    SQL> create index idx on t(val);
    Index created
    SQL> select val, count(*)
      2    from t
      3   group by val;
           VAL   COUNT(*)
             1          1
             2          1
             3     999998So, we have table with very skewed data distribution.
    Let's gather statistics without histograms.
    SQL> exec dbms_stats.gather_table_stats( user, 'T', estimate_percent => 100, method_opt => 'for all columns size 1', cascade => true);
    PL/SQL procedure successfully completed
    SQL> select blocks, num_rows  from dba_tab_statistics
      2   where table_name = 'T';
        BLOCKS   NUM_ROWS
          3106    1000000
    SQL> select blevel, leaf_blocks, clustering_factor
      2    from dba_ind_statistics t
      3   where table_name = 'T'
      4     and index_name = 'IDX';
        BLEVEL LEAF_BLOCKS CLUSTERING_FACTOR
             2        4017              3107
    SQL> select column_name,
      2         num_distinct,
      3         density,
      4         num_nulls,
      5         low_value,
      6         high_value
      7    from dba_tab_col_statistics
      8   where table_name = 'T'
      9     and column_name = 'VAL';
    COLUMN_NAME  NUM_DISTINCT    DENSITY  NUM_NULLS      LOW_VALUE      HIGH_VALUE
    VAL                     3 0,33333333          0           C102            C104So, Oracle suggests that values between 1 and 3 (raw C102 and C104) are distributed uniform and the density of the distribution is 0.33.
    Let's try to explain plan
    SQL> explain plan for
      2  select --+ no_cpu_costing
      3         *
      4    from t
      5   where val = 1
      6  ;
    Explained
    SQL> @plan
    | Id  | Operation         | Name | Rows  | Cost  |
    |   0 | SELECT STATEMENT  |      |   333K|   300 |
    |*  1 |  TABLE ACCESS FULL| T    |   333K|   300 |
    Predicate Information (identified by operation id):
       1 - filter("VAL"=1)
    Note
       - cpu costing is off (consider enabling it)Below is an excerpt from trace 10053
    BASE STATISTICAL INFORMATION
    Table Stats::
      Table:  T  Alias:  T
        #Rows: 1000000  #Blks:  3106  AvgRowLen:  5.00
    Index Stats::
      Index: IDX  Col#: 1
        LVLS: 2  #LB: 4017  #DK: 3  LB/K: 1339.00  DB/K: 1035.00  CLUF: 3107.00
    SINGLE TABLE ACCESS PATH
      BEGIN Single Table Cardinality Estimation
      Column (#1): VAL(NUMBER)
        AvgLen: 3.00 NDV: 3 Nulls: 0 Density: 0.33333 Min: 1 Max: 3
      Table:  T  Alias: T
        Card: Original: 1000000  Rounded: 333333  Computed: 333333.33  Non Adjusted: 333333.33
      END   Single Table Cardinality Estimation
      Access Path: TableScan
        Cost:  300.00  Resp: 300.00  Degree: 0
          Cost_io: 300.00  Cost_cpu: 0
          Resp_io: 300.00  Resp_cpu: 0
      Access Path: index (AllEqRange)
        Index: IDX
        resc_io: 2377.00  resc_cpu: 0
        ix_sel: 0.33333  ix_sel_with_filters: 0.33333
        Cost: 2377.00  Resp: 2377.00  Degree: 1
      Best:: AccessPath: TableScan
             Cost: 300.00  Degree: 1  Resp: 300.00  Card: 333333.33  Bytes: 0Cost of FTS here is 300 and cost of Index Range Scan here is 2377.
    I have disabled cpu costing, so selectivity does not affect the cost of FTS.
    cost of Index Range Scan is calculated as
    blevel + (leaf_blocks * selectivity + clustering_factor * selecivity) = 2 + (4017*0.33333 + 3107*0.33333) = 2377.
    Oracle considers that it has to read 2 root/branch blocks of the index, 1339 leaf blocks of the index and 1036 blocks of the table.
    Pay attention that selectivity is the major component of the cost of the Index Range Scan.
    Let's try to gather histograms:
    SQL> exec dbms_stats.gather_table_stats( user, 'T', estimate_percent => 100, method_opt => 'for columns val size 3', cascade => true);
    PL/SQL procedure successfully completedIf you look at dba_tab_histograms you will see following
    SQL> select endpoint_value,
      2         endpoint_number
      3    from dba_tab_histograms
      4   where table_name = 'T'
      5     and column_name = 'VAL'
      6  ;
    ENDPOINT_VALUE ENDPOINT_NUMBER
                 1               1
                 2               2
                 3         1000000ENDPOINT_VALUE is the column value (in number for any type of data) and ENDPOINT_NUMBER is cumulative number of rows.
    Number of rows for any ENDPOINT_VALUE = ENDPOINT_NUMBER for this ENDPOINT_VALUE - ENDPOINT_NUMBER for the previous ENDPOINT_VALUE.
    explain plan and 10053 trace of the same query:
    | Id  | Operation                   | Name | Rows  | Cost  |
    |   0 | SELECT STATEMENT            |      |     1 |     4 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T    |     1 |     4 |
    |*  2 |   INDEX RANGE SCAN          | IDX  |     1 |     3 |
    Predicate Information (identified by operation id):
       2 - access("VAL"=1)
    Note
       - cpu costing is off (consider enabling it)
    BASE STATISTICAL INFORMATION
    Table Stats::
      Table:  T  Alias:  T
        #Rows: 1000000  #Blks:  3106  AvgRowLen:  5.00
    Index Stats::
      Index: IDX  Col#: 1
        LVLS: 2  #LB: 4017  #DK: 3  LB/K: 1339.00  DB/K: 1035.00  CLUF: 3107.00
    SINGLE TABLE ACCESS PATH
      BEGIN Single Table Cardinality Estimation
      Column (#1): VAL(NUMBER)
        AvgLen: 3.00 NDV: 3 Nulls: 0 Density: 5.0000e-07 Min: 1 Max: 3
        Histogram: Freq  #Bkts: 3  UncompBkts: 1000000  EndPtVals: 3
      Table:  T  Alias: T
        Card: Original: 1000000  Rounded: 1  Computed: 1.00  Non Adjusted: 1.00
      END   Single Table Cardinality Estimation
      Access Path: TableScan
        Cost:  300.00  Resp: 300.00  Degree: 0
          Cost_io: 300.00  Cost_cpu: 0
          Resp_io: 300.00  Resp_cpu: 0
      Access Path: index (AllEqRange)
        Index: IDX
        resc_io: 4.00  resc_cpu: 0
        ix_sel: 1.0000e-06  ix_sel_with_filters: 1.0000e-06
        Cost: 4.00  Resp: 4.00  Degree: 1
      Best:: AccessPath: IndexRange  Index: IDX
             Cost: 4.00  Degree: 1  Resp: 4.00  Card: 1.00  Bytes: 0Pay attention on selectivity, ix_sel: 1.0000e-06
    Cost of the FTS is still the same = 300,
    but cost of the Index Range Scan is 4 now: 2 root/branch blocks + 1 leaf block + 1 table block.
    Thus, conclusion: histograms allows to calculate selectivity more accurate. The aim is to have more efficient execution plans.
    Alexander Anokhin
    http://alexanderanokhin.wordpress.com/

  • Creating table with null and not null values.

    I have to create a table with 5 Null nd 5 Not Null fields.My questionis which fields are place first?Not or Not Null and why???

    What you mean is: the person who asked you the question thought the order of columns was important, and wanted to see if you agreed. Or maybe they were just asking the question to see whether you thought it was important (as a test of your understanding of the database).
    When I started out in Oracle I was told that it was good practice to have the mandatory columns first and then the optional columns. But if you do some research you find this: the impact of column ordering on space management is: empty nullable columns at the end of the table take up zero bytes whereas empty nullable columns at the middle of the table take up one byte each. I think if that saving really is important to you you need to spring for an additional hard drive.
    Besides, even if you do organise your columns as you suggest, what happens when you add an eleventh NOT NULL column to your table? It gets tacked on to the end of your table. Your whole neat organisation is blown.
    What does still matter is the positioning of large VARCHAR2 columns: they should be the last columns on your table in case they create chaining. Then any query that doesn't need the large columns can be satisfied without reading the chained block, something that can't be guaranteed if you've got columns after a VARCHAR2(4000) column. This doesn't apply to CLOBs, etc. which are stored separately anyway.
    Cheers, APC

  • Table files and Index files 2GB on Windows 2003 Server SP2 32-bit

    I'm new to Oracle and I've ran into the problem where my Table files and Index files are > 2GB. I have an Oracle instance running version 10.2.0.3.0. I have a number of tables file and index files that have a current files size of 1.99GB. My Oracle crashes about three times a week because of a "Write Fault/Failure. I've detemined that the RDBM is trying to write a index or table files > 2GB. When this occurs it crashes.
    I've been reading the Oracle knowledge base that it suggest that there is a fix or release of Oracle 10g to resolve this problem. However, I've been unable to locate any fix or release to address my issue. Does such a fix or release exist? How do I address this issue? I'm from the world of MS SQL and IBM DB2 and we don't have this issue. I am running and NTFS files system. Could this be issue be related to an Windows Fix?
    Surely Oracle can handel databases > 2GB.
    Thanks in advance for any help.

    After reading your response it appears that my real problem has to do with checking pointing. I've included below a copy of the error message:
    Oracle process number: 8
    Windows thread id: 3768, image: ORACLE.EXE (CKPT)
    *** 2008-07-27 16:50:13.569
    *** SERVICE NAME:(SYS$BACKGROUND) 2008-07-27 16:50:13.569
    *** SESSION ID:(219.1) 2008-07-27 16:50:13.569
    ORA-00206: Message 206 not found; No message file for product=RDBMS, facility=ORA; arguments: [3] [1]
    ORA-00202: Message 202 not found; No message file for product=RDBMS, facility=ORA; arguments: [D:\ELLIPSE_DATABASE\CONTROL\CTRL1_ELLPROD1.CTL]
    ORA-27072: Message 27072 not found; No message file for product=RDBMS, facility=ORA
    OSD-04008: WriteFile() failure, unable to write to file
    O/S-Error: (OS 33) The process cannot access the file because another process has locked a portion of the file.
    error 221 detected in background process
    ORA-00221: Message 221 not found; No message file for product=RDBMS, facility=ORA
    ORA-00206: Message 206 not found; No message file for product=RDBMS, facility=ORA; arguments: [3] [1]
    ORA-00202: Message 202 not found; No message file for product=RDBMS, facility=ORA; arguments: [D:\ELLIPSE_DATABASE\CONTROL\CTRL1_ELLPROD1.CTL]
    ORA-27072: Message 27072 not found; No message file for product=RDBMS, facility=ORA
    OSD-04008: WriteFile() failure, unable to write to file
    O/S-Error: (OS 33) The process cannot access the file because another process has locked a portion of the file.
    Can you tell me why I'm having issues with checking point and the control file?
    Can I rebuild the control file if it s corrupt?
    The problem has been going on since April 2008. I'm takening over the system.
    Thanks

  • DB02 = Missing Tables and Indexes = Unknown objects in ABAP Dictionary = DB views

    Hi SAP Gurus,
    on our SAP NetWeaver 7.x BW (based on AIX/Oracle) I find via transaction DB02 (path = Diagnostics => Missing Tables and Indexes) under "Unknown objects in ABAP Dictionary" under DB views a BW object /BI0/.....
    When I make a double click on the object, I am getting the popup window "Display not possible for this object":
    How can I identify the object and clarify with the BW application expert, if needed, how to resolve this object?
    I searched already via RSA1 for the object, but I wasn't able to find anything so far ...
    Thanks for your help and ideas.
    Best regards
    Carlos

    Hello Carlos
    The database view in question is a temporary database object created during a query execution.
    Please read this SAP note 449891 - Temporary database objects in BW 3.x to understand what that view is all about and impact if those views are removed.
    The SAP notes 449891 and 1139396 suggests to run the report SAP_DROP_TMPTABLES to drop these temporary objects. Whether the objects are still required or not is a question to be put across to the BW team. If the temporary objects are removed when they are used by a query, then the query will fail.
    Have a nice day
    RB

  • Case insensitive search and index

    I have to execute a case insentitive search.
    I created this index on a not null field:
    create index indx_prova on
    table (nlssort(campo, 'NLS_SORT=BINARY_CI'));
    The select is:
    select * from tabella where campo like 'A storage%'
    This select should retrive 5 records:
    A storage ring for crystalline beam studies
    a storage ring for crystalline beam studies
    A Storage Ring for Crystalline Beam Studies
    A storage ring for crystalline beam studies
    A storage ring for crystalline beam studies
    Instead I got only 3 records:
    A storage ring for crystalline beam studies
    A storage ring for crystalline beam studies
    A storage ring for crystalline beam studies
    So The query isn't case insensitive.
    I can't set nls_sort=BINARY_CI and nls_comp=LINGUISTIC at level session.
    Is there a solution.
    Am I doing something wrog?

    I set alter session set nls_comp=LINGUISTIC; alter session set nls_sort=BINARY_CI;
    I create this index:
    create index titolo_indx on
    table (nlssort(campo, 'NLS_SORT=BINARY_CI'));
    If I execute this query:
    select * from ri01_prodotti where titolo like 'A storage ring f%'
    Oracle doesn't user the index.
    SQL_ID 7yvspnyf96vp8, child number 0
    select * from ri01_prodotti where titolo like 'A storage ring%'
    Plan hash value: 350479533
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 2020 (100)| |
    |* 1 | TABLE ACCESS FULL| TABLE | 1 | 1365 | 2020 (1)| 00:00:25 |
    Predicate Information (identified by operation id):
    1 - filter("CAMPO" LIKE 'A storage ring%')
    If I execute a query with =, oracle use index.
    select * from table where campo ='A storage ring for crystalline beam studies'
    SQL_ID 5jzr5nm6b37pq, child number 0
    select * from ri01_prodotti where titolo ='A storage ring for crystalline beam
    studies'
    Plan hash value: 3866031381
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 151 (100)| |
    | 1 | TABLE ACCESS BY INDEX ROWID| RI01_PRODOTTI | 377 | 502K| 151 (0)| 00:00:02 |
    |* 2 | INDEX RANGE SCAN | TITOLO_INDX | 151 | | 3 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - access("RI01_PRODOTTI"."SYS_NC00078$"=HEXTORAW('612073746F726167652072696E6720
    666F72206372797374616C6C696E65206265616D207374756469657300') )

  • How to avoid this full table scan (and index FFS) ?

    Hi All,
    Oracle 11.2 on Linux.
    See this query and its plan below
    SQL> DELETE
      2  FROM  TABLEA APE
      3        WHERE   NOT EXISTS
      4                   (SELECT   1
      5                      FROM   TABLEB AP
      6                     WHERE       AP.col1 = APE.col1
      7                             AND AP.col2 = APE.col2
      8                             AND AP.col3 = APE.col3)
      9  AND ROWNUM < 51 ;
    50 rows deleted.
    Elapsed: 00:12:01.07
    Execution Plan
    Plan hash value: 1740911877
    | Id  | Operation               | Name                  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time  |
    |   0 | DELETE STATEMENT        |                       |    50 |  2650 |       |   573K  (1)| 01:54:40 |
    |   1 |  DELETE                 | TABLEA                |       |       |       |            |       |
    |*  2 |   COUNT STOPKEY         |                       |       |       |       |            |       |
    |*  3 |    HASH JOIN RIGHT ANTI |                       |    80M|  4059M|  1775M|   573K  (1)| 01:54:40 |
    |   4 |     INDEX FAST FULL SCAN| TABLEB_UK             |    47M|  1228M|       | 96480   (1)| 00:19:18 |
    |   5 |     TABLE ACCESS FULL   | TABLEA                |    80M|  1991M|       |   243K  (1)| 00:48:42 |
    ---------------------------------------------------------------------------------------------------------In both tables, TABLEA and TABLEB, there is index on columns col1-col2-col3 as leading columns (TABLEB has few more columns in the index, but after these 3 columns).
    Requirement is, I want to delete first 50 records in TABLEA, which does not exist in TABLEB.
    I tried with various hints, but Oracle is always doing a full scan on one of the tables and index FFS on other. In some cases, Oracle did full scan on both tables and then deleted 50 records. Stats is up-to-date. Doing a full scan on tables with 80 million and 47 million rows is a bit too much for deleting 50 rows.
    How I can make Oracle do
    1) Read TABLEA row-by-row
    2) for each row, check if it exists in TABLEB
    3) If not exists, then delete row from TABLEA, else continue
    4) Stop reading TABLEA after we have deleted 50 records
    Thanks in advance

    >
    >
    Oracle 11.2 on Linux.
    SQL> DELETE
    2  FROM  TABLEA APE
    3        WHERE   NOT EXISTS
    4                   (SELECT   1
    5                      FROM   TABLEB AP
    6                     WHERE       AP.col1 = APE.col1
    7                             AND AP.col2 = APE.col2
    8                             AND AP.col3 = APE.col3)
    9  AND ROWNUM < 51 ;
    50 rows deleted.
    Elapsed: 00:12:01.07
    Execution Plan
    Plan hash value: 1740911877
    | Id  | Operation               | Name                  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time  |
    |   0 | DELETE STATEMENT        |                       |    50 |  2650 |       |   573K  (1)| 01:54:40 |
    |   1 |  DELETE                 | TABLEA                |       |       |       |            |       |
    |*  2 |   COUNT STOPKEY         |                       |       |       |       |            |       |
    |*  3 |    HASH JOIN RIGHT ANTI |                       |    80M|  4059M|  1775M|   573K  (1)| 01:54:40 |
    |   4 |     INDEX FAST FULL SCAN| TABLEB_UK             |    47M|  1228M|       | 96480   (1)| 00:19:18 |
    |   5 |     TABLE ACCESS FULL   | TABLEA                |    80M|  1991M|       |   243K  (1)| 00:48:42 |
    ---------------------------------------------------------------------------------------------------------Requirement is, I want to delete first 50 records in TABLEA, which does not exist in TABLEB.
    Such requirements usually make me curious - what's special about a randomly selected 50 rows ?
    Is this trying to delete the data in batches of 50 rows at a time.
    How I can make Oracle do
    1) Read TABLEA row-by-row
    2) for each row, check if it exists in TABLEB
    3) If not exists, then delete row from TABLEA, else continue
    4) Stop reading TABLEA after we have deleted 50 records
    It look's as if a 'no_unnest' hint in the subquery should do what you want. It should make Oracle run the quey with a FILTER subquery. You could then choose to drive the delete through a tablescan of tableA or an index range scan of the index on tableA. Have you considered the effect of (and requirements relating to) nulls in the three columns of either table ?
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    Author: <b><em>Oracle Core</em></b>

  • Cannot INSERT records into Partitioned Spatial Table and Index

    I am trying to tune our Spatial Storage by creating partitioning our spatial_entity table and index. I used the World Geographic Reference System (GEOREF) creating a partition for each 15 x 15 degree grid square assigning a partition key of decimal longitude, decimal_latitude. The build went OK, however when trying to insert a data record I receive an ORA-14400: Inserted partition key does not map to any partition.
    I validated the CREATE(s), and all appears correct, but obviously something is not correct, which is prompting for expert help in this forum.
    I would be very grateful for your help.
    Below are the code snippets for the table and index, and an insert statement.
    CREATE TABLE spatial_entity
         geoloc_type VARCHAR2 (60 BYTE) NOT NULL
    ,entity_id NUMBER NOT NULL
    ,metadata_xml_uuid VARCHAR2 (40 BYTE) NOT NULL
    ,geoloc MDSYS.sdo_geometry NOT NULL
    ,nee_method CHAR (1 BYTE) NOT NULL
    ,nee_status CHAR (1 BYTE) NOT NULL
    ,decimal_latitude NUMBER (15, 6) NOT NULL
    ,decimal_longitude NUMBER (15, 6) NOT NULL
    PARTITION BY RANGE (decimal_longitude, decimal_latitude)
         PARTITION p_lt_0_90s
              VALUES LESS THAN (1, -90)
         ,PARTITION p_lt_0_75s
              VALUES LESS THAN (1, -75)
         ,PARTITION p_lt_0_60s
              VALUES LESS THAN (1, -60)
         ,PARTITION p_lt_0_45s
              VALUES LESS THAN (1, -45)
         ,PARTITION p_lt_0_30s
              VALUES LESS THAN (1, -30)
         ,PARTITION p_lt_0_15s
              VALUES LESS THAN (1, -15)
         ,PARTITION p_lt_0_0
              VALUES LESS THAN (1, 0)
         ,PARTITION p_lt_0_15n
              VALUES LESS THAN (1, 15)
         ,PARTITION p_lt_0_30n
              VALUES LESS THAN (1, 30)
         ,PARTITION p_lt_0_45n
              VALUES LESS THAN (1, 45)
         ,PARTITION p_lt_0_60n
              VALUES LESS THAN (1, 60)
         ,PARTITION p_lt_0_75n
              VALUES LESS THAN (1, 75)
         ,PARTITION p_lt_0_90n
              VALUES LESS THAN (1, maxvalue)
    CREATE INDEX geo_spatial_ind ON spatial_entity (geoloc)
    INDEXTYPE IS mdsys.spatial_index
    PARAMETERS ('layer_gtype=MULTIPOINT TABLESPACE=GEO_SPATIAL_IND') LOCAL
    (PARTITION p_lt_0_90s,
    PARTITION p_lt_0_75s,
    PARTITION p_lt_0_60s,
    PARTITION p_lt_0_45s,
    PARTITION p_lt_0_30s,
    PARTITION p_lt_0_15s,
    PARTITION p_lt_0_0,
    PARTITION p_lt_0_15n,
    PARTITION p_lt_0_30n,
    PARTITION p_lt_0_45n,
    PARTITION p_lt_0_60n,
    PARTITION p_lt_0_75n,
    PARTITION p_lt_0_90n,
    INSERT INTO spatial_entity
         geoloc_type
         ,entity_id
         ,metadata_xml_uuid
         ,geoloc
         ,nee_method
         ,nee_status
         ,decimal_latitude
         ,decimal_longitude
    VALUES
                   'BATCH'
                   ,0
                   ,'6EC25B76-8482-4F95-E0440003BAD57EDF'
                   ,"MDSYS"."SDO_GEOMETRY"
                        2001
                        ,8307
                        ,"MDSYS"."SDO_POINT_TYPE" (32.915286, 44.337902, NULL)
                        ,NULL
                        ,NULL
                   ,'M'
                   ,'U'
                   ,32.915286
                   ,44.337902
    Thank you for you help.
    Dave

    Thank you for your quick reply. I did not post the entire CREATE script as it is quite long. The portion of the script that is applicable to the INSERT is:
    ,PARTITION p_lt_45e_90s
              VALUES LESS THAN (23, -90)
         ,PARTITION p_lt_45e_75s
              VALUES LESS THAN (23, -75)
         ,PARTITION p_lt_45e_60s
              VALUES LESS THAN (23, -60)
         ,PARTITION p_lt_45e_45s
              VALUES LESS THAN (23, -45)
         ,PARTITION p_lt_45e_30s
              VALUES LESS THAN (23, -30)
         ,PARTITION p_lt_45e_15s
              VALUES LESS THAN (23, -15)
         ,PARTITION p_lt_45e_0
              VALUES LESS THAN (23, 0)
         ,PARTITION p_lt_45e_15n
              VALUES LESS THAN (23, 15)
         ,PARTITION p_lt_45e_30n
              VALUES LESS THAN (23, 30)
         ,PARTITION p_lt_45e_45n
              VALUES LESS THAN (23, 45)
         ,PARTITION p_lt_45e_60n
              VALUES LESS THAN (23, 60)
         ,PARTITION p_lt_45e_75n
              VALUES LESS THAN (23, 75)
         ,PARTITION p_lt_45e_90n
              VALUES LESS THAN (23, maxvalue)
    Or, I do not fully understand. Are you indicating that I must explcitly state the longitude in each clause,
    e.g ,PARTITION p_lt_45e_45n
              VALUES LESS THAN (45, 45)
    ,PARTITION p_lt_45w_45n
              VALUES LESS THAN (-45, 45)
    If so, that answers the question of why it cannot find a partition, however an Oracle White Paper "Oracle Spatial Partitioning Best Practices" Sept 2004, discusses multi column partitioning such as represented by this problem, and gives an INSERT statement example of :
    CREATE TABLE multi_partn_table (in_date DATE,
    geom SDO_GEOMETRY, x_value NUMBER, y_value NUMBER)
    PARTITION BY RANGE (X_VALUE,Y_VALUE)
    PARTITION P_LT_90W_45S VALUES LESS THAN (1,-45),
    PARTITION P_LT_90W_0 VALUES LESS THAN (1,0),
    PARTITION P_LT_90W_45N VALUES LESS THAN (1,45),
    PARTITION P_LT_90W_90N VALUES LESS THAN (1,MAXVALUE
    and as I am writing this I am seeing that I failed to include the longitude and latitude in the SDO_GEOMETRY clause, so it does appear tht I need to explicitly state the longitude valuues.
    What is your judgement sir?
    Dave

  • Fragmentation in tables and indexes with 9.2.0.5

    Hi guys ,
    I need of query to identified fragmentation in tables and indexes using Oracle 9i,someone could help me send that's querys
    tks
    spaulonci

    Fragmentation by itself at the tablespace level doesn't mean any thing from the performance point of view, only from the storage capacity perspective, and this just in case fragments are not necessarily the same size as in the case of dictionary manged tablespaces.
    You may be concerned about block density, which actually could lead to performance degradation. I suggest you to consider using coalesce instead of rebuilding in the case of indexes, and in the case of tables you should perform a segment reorganization. In the case of 9iR2 the coalesce command for table segments is not available so you will have to perform another segment reorganization strategy. If there are meaningful differences with the high water mark, average number of rows per block and chained rows then you will notice performance differences.
    I suggest you to take metrics for block usage prior to perform an index coalesce operation, as well as prior to perform a data segment reorganization to assess if the reorganization effort is useful.
    ~ Madrid
    http://hrivera99.blogspot.com/

  • UltraSearch - Numbers of document discovered, fetched and indexed

    I am using US 1.0.3.
    - I have a table data source mapped to a table with the following characteristics:
    > PK is a composite of three columns
    > table has a total of 970 rows
    > the column TITLE which is of varchar2 is specified as the content column
    > Of the 971 rows, 82 rows have NULL in TITLE column.
    > Of the 971 rows, only 196 rows have unique TITLE.
    > There is no attribute mapping
    - Here is the crawler summary:
    Document discovered: 381
    Document fetched: 381
    Document indexed: 196
    The rest are zeros.
    My questions are:
    (1) It seems US only indexes rows with unique value which explains why only 196 rows/documents are indexed. That is, rows with duplicate TITLE are not indexed. It seems to make sense. Is that correct?
    (2) But why only 381 documents/rows are discovered and fetched? I would think it would discovered all the rows with NON-NULL value in the TITLE column: 889 (i.e. 971 82).
    (3) In summary, how does US determine what rows to fetch and index?
    Thanks!
    C Cheung

    Hi nyzonegirl,
    Welcome to Numbers discussions.
    Yvan is correct; nothing neither in iWork nor any Mac application will remove MS Office—Excel. If you were using Numbers there is a 30 trial for it, after 30 days it stops working or one purchases it. So it seems that the Excel work sheet you were using may have opened in Numbers not your Excel—a file association thingy.
    Find on your HDD the Excel .XLS file, click on it once to highlight it. Now click File > Get Info, down the list it will read Open with:, change it to Excel (it may read Numbers). You'll have the choice to have all like files open in Excel as well.
    Yes you're correct, Windows users won't be able to open Numbers files so if you decide to purchase iWork you'll need to do as Yvan suggested, Export to Excel.
    As the need arises I use Excel, however, for my personal use 100% of the time I use Numbers. When I know Functions are the same I'll use Numbers then Export to Excel for Windows users.
    Hope this helps you. Do let us know the outcome.
    Sincerely,
    RicD

  • Caching/Pinning tables and indexes - Howto?

    Hi all,
    I've hit upon a request by a COTS vendor to do something I'm not terribly familiar with....they want to 'cache' or 'pin' a table and an index in memory.
    I was researching, and saw something to the effect of doing for Table1
    ALTER TABLE Table1 CACHE;
    However, the vendor was mentioning some examples that seemed to indicate creating a keep pool (a separate buffer cache pool?)...and then doing something like
    ALTER TABLE Table1 STORAGE (buffer_pool KEEP)
    Can someone give me some insight as to the difference between these two concepts...links on how to do it, etc?
    Thanks in advance!
    cayenne

    burleson wrote:
    Here is the script that I use to automate the assignment of tables into the KEEP pool.
    BEWARE: This script is not for beginners:
    http://www.rampant-books.com/t_oracle_keep_pool_assignment.htm
    Hope this helps . . .
    Dear Mr. Burleson,
    I note that the article referenced makes the following comment about Oracle's suggestion for good candidates:
    <ul>
    +"It is easy to locate segments that are less than 10% of the size of their data buffer, but Oracle does not have a mechanism to track I/O at the segment level. To get around this issue, some DBAs place each segment into an isolated tablespace, so that the AWR can show the total I/O."+
    </ul>
    Oracle 9i introduced v$segstat - which tracks several different statistics at segment level. Statspack (when taking snapshots at level 7) and the AWR both capture and report segment level statistics. These statistics include the physical reads in 9i, and the number of segment scans in 10g.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

Maybe you are looking for

  • Can I run an iMac G3 266 in Kiosk mode?

    I have an old iMac G3 266 that I want to donate to the local YMCA. They need something to have for members to complete an online form. The computer is running OS 8.6. Is there a way I can: 1) Run it in kiosk mode and have it go to one website OR 2) U

  • Next locations setting missing

    Hi @ all, I have installed iOS 7 on September, 19th. Nonetheless I am missing the option "Next Locations" in the Notification Center settings. I am only seeing: 1. Today Summary, 2. Calendar Day View, 3. Reminders, 4. Stocks and 5. Tomorrow Summary.

  • HT201302 iPhoto isn't picking up on my iPod.

    When I plug my iPod in using a cable, iPhoto doesn't pick up on my iPod, so I can't sync my photos to my computer!

  • Start program from shortcut (NativeProcess)

    Hello, I'm trying to create an AIR app which will allow the user to drop the program's executable file into the app and then the program would start up. I've got it running but I'm facing problem when I want to drop in the executable's shortcut from

  • ON Adobe TV where are the downloadable sample files?

    I am trying to take a basic tutorial, but can't find the files. Any help?