How to combine spatial and secondary index, when extracting?

Hi spatiallers,
vers.: (32 bit) Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production on Sun/SunOS 5.8 (64 bit)
In our DataWarehouse the table topo_geodata stores all topographic data in Denmark. The table has a spatial index (QT) on its SDO_geometry column named utm_geo as well as a primary key on the column topo_geo_id and 4 secondary indexes on other columns.
The query to find all geomtries in a given munipalicy is as follows
select count(*) as antal_AnyInteract_topo_geodata
from topo_geodata k, topo_geodata tg
where SDO_RELATE(tg.utm_geo, k.utm_geo, 'mask=AnyInteract querytype= WINDOW') = 'TRUE'
and k.topo_geo_id = 961 -- geometry of a municipality
and it returns a count of 19445 in 4 minuttes. However our users are only interested in extracting certain object types, that is a very small subselection of the 19445 geometries. The subselection is typically based on some value or a range of values in the secondary indexed columns.
Question: How can I make the SELECT use a combination of the spatial index index and a secondary index?
Only when a pinpoint 1 particular value of the primary key do I get fast response. When pinpointing 1 value in a secondary index as in
select count(*) as antal1
from topo_geodata k, topo_geodata tg
where SDO_RELATE(tg.utm_geo, k.utm_geo, 'mask=AnyInteract querytype= WINDOW') = 'TRUE'
and k.topo_geo_id = 961 -- Gladsaxe
and tg.mtk_obj_id = 58476 -- has secondary index
the performance deteriorates back to 4 min., and the queryplan shows some weird bitmap conversion followed by a bitmap-and operation.
- Thanks in advance,
Jens Ole Jensen
Kort & MatrikelStyrelsen (WWW: http://www.kms.dk)
Danmark

Hi Jens,
I'm not sure I understand the question, or what it is that works fast.
In this case, the SDO_RELATE with the anyinteract mask has to be done first.
If this takes 4 minutes, then adding additional criteria to reduce the amount of
data returned from that subset will only add time.
The spatial portion of the query has to be done using the spatial index, which is
a monolithic index for the whole table, so all of the geometry data has to be searched,
and the anyinteract applied to all of this data.
After that set of rows comes back, then the additional predicate is applied.
I'm not sure what this means:
Only when a pinpoint 1 particular value of the primary key do I get fast response. You do have a few options to try to make things work faster:
If queries included additional predicates on mtk_obj_id, you might try
to use range partitioning.
If the predicates on mtk_obj_id is very selective, then you might want to select
values based on that column, then use sdo_geom.relate between that very
small subset and the query window.
Hope this helps, and all is well with you.
Dan

Similar Messages

  • Difference between primary eindex and secondary index?

    hi experts
    pls answer me
    difference between primary eindex and secondary index?
    rewads apply.
    thanks.
    naresh.

    hi,
    check this link.
    http://help.sap.com/saphelp_47x200/helpdata/en/cf/21eb2d446011d189700000e8322d00/frameset.htm
    A difference is made between Primary & Secondary indexes to a table. the primary index consists of the key fields of the table and a pointer to the non-keys-fields of the table. The Primary index is generated automatically when a table is created and is created in the datebase as the same times as the table. It is also possible to define further indexes to a table in the ABAP/4 dictionary, which are then referred to as Secondary indexes.
    Always it is not mandatory that an index should have all the key fields of a table. To see the index of a table
    goto SE11->specify table name->click on the indexes... button on the application toolbar.
    Based on your requirement you can you any of those index fields in the where clause of your query. Always its a better practice to use the index fields in the order specified. While selecting the records from a table it is always better to select the fields in the same order as specified in the table.

  • Identifying primery and secondary Indexes in ABAP Programs

    Hi all,
    i have used primary Index and Secondary Indexes in my ABAP program. my question is i want to identify Indexes which i used in my programs. how can i identify them? is there any method.tell me with great details.

    Switch on SQL trace (ST05), run the program, study the SQL trace.
    Thomas
    Good blog on the topic: The SQL Trace (ST05) – Quick and Easy

  • How to revert back of secondary indexes created?

    Hi all,
                     I have craeted secondary indexes in development and they have been transported into quality and production. Some dumps are coming in the production because of these secondary indexes.
    Please guide me how to revert back those secondary indexes from production(means to keep original with out that secondary indexes?)
    Please give me solution.
    Regards,
    Lokesh

    Hello,
    The best way to do this is delete the indexes again in DEV and create a transport request.
    Transport this request to QA and PRD and the index will be deleted.
    Via SE14 you can also delete the index immed in PRD.
    SE14 will only delete the index from the database (shortdumps will disappear then).
    Afterwards you can still use SE11 to delete the index from the SAP repository as well.
    Success.
    Wim
    Edited by: Wim Van den Wyngaert on Nov 20, 2009 1:08 PM

  • How does BDB update its secondary index?

    I am asking how does Berkeley DB update its secondary index?
    For example, in a BDB table with key value pair ``<k,v1>``, the index database would have reversed pair like ``<v1,k>``. Upon an insert (or essentially an update) ``<k,v2>``, base table record ``<k,v1>`` should be overwritten to ``<k,v2>``.
    But how would BDB deal with ``<v1,k>`` in the index table? Will it delete it immediately?

    Hi,
    As long as you correctly open the primary database and secondary index database, and associate the secondary index database with the primary, any update on the primary database will be reflected in the secondary index.
    For more information, please refer to Reference Guide for Berkeley DB -> Chapter 3.  Access Method Operations -> Secondary Indexes section.
    Regards,
    Cindy Zeng

  • How to combine sales and delivery data

    hi
    i have requirement to make a report from sales as well as deliveries. Important fields in report are sales document , material , plant , sales document type , country key , sold to party , ordered quantity , delivered quantity , price from vakon ( KBETR ), actual goods issue date.
    The required extractors are 2LIS_11_VASCL, 2LIS_11_V_SSL ,2LIS_11_VAKON.
    Problem is how to combine sales and delivery data as V_SSL has different key figures.Multicube is not the solution as dont have plant , sold to party and many other fields in V_SSL.
    Kindly suggest how to combine sales and deivery data.
    Regards,
    Monika

    I guess you do have shipping point in delivery.
    In most scenarios shipping point may not(or) may be same like order plant.
    Although they are different you can still roll up the delivery information to order level by plant since you have order # available as reference key in delivery.
    With this reference key you can convert all delivery information to order (item) level.
    I guess you can use one merge ODS with one cube (or) with 2 ODS for each at order level for validation.
    You may have to map delivery type to order type as per R3 configuration as well.
    speak with any Logistics guys for help.
    cheers
    Martin

  • How to combine servlet and jsp

    I'm doing a project. My friend using jsp. and i using servlet..
    we are confused, how to combine servlet and jsp. or we can just use redirect??
    but it's still doesn't work properly...thanks for your helpp

    You can use RequestDispatcher interface for calling a JSP from a Servlet, or vice-versa.
    Following is the code for sending output to a JSP page from a servlet:
    javax.servlet.RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(�/Ashu.jsp�);
    request.setAttribute(�Name�,�Ashutosh�);
    dispatcher.forward(request,response);
    - Ashutosh

  • How Database chooses the proper Secondary index

    Hello All,
              Can any one tell me how database find the proper secondary index, in my case database is taking the wrong index leading to performance problem..
    Please help
    Regards.
    Anmol

    Hi Rob, Hi Herrman,
    The Statistics are.
    Last statistics date                  05/26/2008
    Analyze Method              mple 16,671,728 Rows
    Number of rows                        16,671,728
    Number of blocks allocated             1,346,764
    Number of empty blocks                     1,880
    Average space                                983
    Chain count                                    0
    Average row length                           573
    Partitioned                                   NO
    NONUNIQUE  Index   LTAP~Z01                                                                  
    Column Name                     #Distinct                                                      
    MANDT                                          1 
    NLENR                                  5,361,981 
    VLENR                                  5,293,012 
    Last statistics date                    /  /     
    Analyze Method                      Not analyzed 
    Levels of B-Tree                               0 
    Number of leaf blocks                          0 
    Number of distinct keys                        0 
    Average leaf blocks per key                    0 
    Average data blocks per key                    0 
    Clustering factor                              0                                               
    NONUNIQUE  Index   LTAP~Z02                      
    Column Name                     #Distinct                                             
    MANDT                                          1 
    LGNUM                                          6 
    VLTYP                                         29 
    VLPLA                                    464,011 
    PQUIT                                          2 
    Last statistics date                  05/26/2008 
    Analyze Method              mple 16,671,728 Rows 
    Levels of B-Tree                               3 
    Number of leaf blocks                    119,190 
    Number of distinct keys                  479,275 
    Average leaf blocks per key                    1 
    Average data blocks per key                   19 
    Clustering factor                      9,327,938 
    NONUNIQUE  Index   LTAP~Z03                                                             
    Column Name                     #Distinct                                                         
    MANDT                                          1  
    LGNUM                                          6  
    NLTYP                                         30  
    NLPLA                                    338,815  
    PQUIT                                          2  
    Last statistics date                  05/26/2008  
    Analyze Method              mple 16,671,728 Rows  
    Levels of B-Tree                               3  
    Number of leaf blocks                    115,356  
    Number of distinct keys                  341,753  
    Average leaf blocks per key                    1  
    Average data blocks per key                   23  
    Clustering factor                      8,025,025

  • How to combine insert and where query ?

    hi..
    could somebody guide me how to combine insert and where query ?
    insert into tdc_imarspc (ANUMBER,EMF_ID,PRODUCT) values ('1234567','65','ITFS')
    where anumber not like '1234567';
    Thank you,
    Baharin

    Hi, Baharin,
    As Mahesh said, WHERE only works on a query.
    You can always base a query on dual, like this:
    INSERT INTO
    tdc_imarspc (ANUMBER,     EMF_ID,     PRODUCT)
    SELECT          '1234567',     '65',     'ITFS'
    FROM         dual
    WHERE          anumber      NOT LIKE '1234567';Of course, you can use a literal, like '1234567' in both places where I used the bind variable, but if you're not using a variable, why would you want to?
    You could also put all the literals in a sub-query (based on dual), and reference column names in the main WHERE clause, LIKE THIS:
    INSERT INTO
    tdc_imarspc (     ANUMBER,     EMF_ID,          PRODUCT)
    WITH     sub_q
    AS  (
        SELECT    '1234567' AS an,     '65' AS ei,     'ITFS' AS pr
        FROM      dual
    SELECT          an,          ei,          pr
    FROM     sub_q
    WHERE      an      NOT LIKE '1234567'; 
    I assume you're not really saying
    an      NOT LIKE '1234567'If you're not using any wild cards after LIKE, you might as well use !=
    an      != '1234567'

  • Data deletion on primary index and secondary index

    Hello, I have a question regarding data deletion in BDB-JE.
    Suppose I have an Entity class which has a primary index and a secondary index, the secondary key does not have outer related entity. So when I want to delete this entity, is it correct we only need to remove the entity from primary index? or I also need to do it for secondary index or just remove it from secondary index and internally BDB_JE will remove it from primary index?
    Thanks
    Anfernee

    You can delete an Entity using the delete method for primary index or the secondary index. When an entity is deleted, secondary index records are automatically deleted. The primary and secondary indices are always kept in sync.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How does OWB deal with bitmap indexes when inserting?

    How does OWB 9.2 deal with bitmap indexes on a fact table when records are inserted from a staging table? It seems to me that they are left on the table, while in the 9i Server manuals it says that one should not perform heavy DML in this case, because this slows down the inserts considerably and the indexes can get bloated. Should one define a premapping and postmapping process for removal and recreation of the bitmap indexes?
    How handles OWB bitmap indexes in case of PEL and what action should one take then?
    Jaap.

    Hai Japp,
    It depends on the volume of the data.
    The best way is drop index in pre mapping process and recreate it in post mapping process.
    You need to use EXECUTE IMMEDIATE command in the procedure to create or drop indexes.
    e.g:
    EXECUTE IMMEDIATE 'CREATE BITMAP INDEX INDX_BI_TABLE ON TABLE_NAME(COL_NAME)'
    Regards,
    Malli

  • How to rename database with secondary indexes.

    Hi,
    could somebody advise how to run correct next operation:
    I have database with secondary indexes in a single file and I need to rename that db file.
    As I understand I have to
    1) close and delete all database handles
    2) remove from db file all secondary indexes with DbEnv::dbremove
    3) rename db file with DbEnv::dbrename
    4) create primary db
    5) create once again all secondary indexes and associate them with primary db
    Appreciate in advance.

    Hi,
    Your question has two possible cases:
    1. A single file contains main DB and its secondary indexes.
    2. A file contains several secondary indexes of main DB, another file contains the main DB.
    For the first case, the main database could be renamed directly, but all of the secondary databases do not continue to work. That means no new index items will be added automatically into exist secondary databases. So these secondary databases should be removed and created, you could also just run a DB->associate to re-associate it again. But in the later way, the re-associated secondary DB won't automatic index these records that are added before associating.
    That means, if main db is renamed and then inserted a record 'A'. Then secondary DB is re-associated to main db. The secondary DB still does not index record 'A'. And currently there is not method to let secondary DB manually index 'A' again. So it is better to remove and create a new secondary DB with DB_CREATE flag. That will make the new secondary DB scan current items and index them.
    For the second case, the result is the same, main database could be remained directly. Then all of the secondary databases should be re-created or re-associated. Still for the described reason, we prefer the first way.
    And, removing old secondary databases before renaming main database is also work in above cases.
    Thanks,
    Victor Yang

  • Primary index and secondary index in a select query

    Hii,
    How to use a primary or secondary  index in a select query?  How does this indexes actually work?
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Jan 21, 2012 8:38 PM

    rajan please just google or search SDN. there are large number of post for this..
    to give you a head start: for using a particular index in the select query a %_HINTS ORACLE 'INDEX clause is added

  • How do u fix and ipod touch when it wont open games to play

    how do u fix an ipod touch when it wont open games tp play

    try closing all your background apps by hit the home button 2 times and holding down on the apps and if that does not work try rebooting it

  • Silly questions but new on apple, Q1 how do I cut and paste Q2 when I have a spelling error with the red line under it how do I correct it?

    Q1 How do I cut and paste
    Q2 how do I correct a spelling error when it has a red line under it?

    Lynnie2002 wrote:
    Q1 How do I cut and paste
    Highlight the item.
    Finder>Edit>Copy
    Place the item where you want to
    Finder>Edit>Paste
    There is 3rd party software that makes cut & paste easier with just 1 or 2 steps. 
    Q2 how do I correct a spelling error when it has a red line under it?
    You can find the correct spelling in the Apple dictionary.  Just add the correct spelling & delete the error.
    Care to share which OS you are using and which model iMac you have? 

Maybe you are looking for

  • How do I transfer my itunes library from one notebook to another?

    Hi.  I just got a new notebook and wanted to add songs to my ipod.  I downloaded itunes and added songs but when I tried to sync the ipod, I got the feedback that the ipod can only be synced with one itunes library.  How do I transfer my itunes libra

  • How to best support CT2, CT3 and CT4 clients from the same machine?

    I have clients that are still insisting on CT2 and CT3 for their editing. I am able to use CT3 with work arounds for my CT2 customes; but would like to get on with CT4. Can anyone point me to the Tips and Techniques that will point out the "gotcha's"

  • Time Machine backup in real time?

    I'm about to get a new Mac Mini for my girlfriend and thought about getting an additional external hard drive for Time Machine backups. I have never used Time Machine and the help topics/manuals seem to indicate you can only backup every hour. Can yo

  • Full screen sharpening question 3.0

    Hello, I notice that the sharpening applied in edited images is only visible full screen when you first zoom in and out. When after that I look at another image and return to the first one the full screen sharpening is again not visible, and zooming

  • Library shows duplicate songs but are same file

    My Libray and Playlists show duplicate titles and songs and when I check file info they are the exact file and location. The problem is that when you check one of the duplicates it also checks the other and plays the same song twice in a row. Bear in