Use of Index although a great number of rows is returned....

Hi ,
I have created the following table:
create table all_obj select * from all_objects;
Then i created some indexes:
create index idx_obj on all_obj (object_name)
create index idx_owner on all_obj (owner)
Then i issued the sql statement:
SQL> select count(object_name),owner from all_obj group by owner;
COUNT(OBJECT_NAME) OWNER
               719 MDSYS
               266 SCOTT_BI
               266 INFO_BI
                 2 TSMSYS
               118 DMSYS
20146 PUBLIC
                 6 OUTLN
               171 CTXSYS
               612 OLAPSYS
               400 SYSTEM
               168 EXFSYS
43 SCOTT
                32 DBSNMP
              1638 ORDSYS
                 5 ORDPLUGINS
               866 SYSMAN
               284 XDB
20993 SYS
               264 INFORMATICS
               212 WMSYS
COUNT(OBJECT_NAME) OWNER
                 8 SI_INFORMTN_SCHEMA
21 rows selectedand...:
SQL> analyze table all_obj compute statistics;
Table analyzedAt last , i issued the following pair of sql statements:
SQL> select object_name,owner from scott.all_obj where owner='SCOTT'
  2  /
43 ãñáììÝò åðéëÝ÷èçêáí.
Ðñüãñáììá åêôÝëåóçò
Plan hash value: 2272571446
| Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| T
ime     |
|   0 | SELECT STATEMENT            |           |  2249 | 65221 |    68   (0)| 0
0:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| ALL_OBJ   |  2249 | 65221 |    68   (0)| 0
0:00:01 |
|*  2 |   INDEX RANGE SCAN          | IDX_OWNER |  2249 |       |     6   (0)| 0
0:00:01 |
Predicate Information (identified by operation id):
   2 - access("OWNER"='SCOTT')
ÓôáôéóôéêÜ
          0  recursive calls
          0  db block gets
         12  consistent gets
          0  physical reads
          0  redo size
       1692  bytes sent via SQL*Net to client
        407  bytes received via SQL*Net from client
          4  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
         43  rows processedand
SQL> select object_name,owner from scott.all_obj where owner='SYS';
20993 ãñáììÝò åðéëÝ÷èçêáí.
Ðñüãñáììá åêôÝëåóçò
Plan hash value: 2272571446
| Id  | Operation                   | Name      | Rows  | Bytes | Cost (%CPU)| T
ime     |
|   0 | SELECT STATEMENT            |           |  2249 | 65221 |    68   (0)| 0
0:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| ALL_OBJ   |  2249 | 65221 |    68   (0)| 0
0:00:01 |
|*  2 |   INDEX RANGE SCAN          | IDX_OWNER |  2249 |       |     6   (0)| 0
0:00:01 |
Predicate Information (identified by operation id):
   2 - access("OWNER"='SYS')
ÓôáôéóôéêÜ
          0  recursive calls
          0  db block gets
       3345  consistent gets
          0  physical reads
          0  redo size
     801069  bytes sent via SQL*Net to client
      15774  bytes received via SQL*Net from client
       1401  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
      20993  rows processed
The question is: why the second query uses the index since a great number of records is returned......????
I use Oracle10g.v.2
Thanks...
Sim

You were right.....
using:
SQL> EXEC DBMS_STATS.gather_schema_stats(ownname => 'SCOTT');
the optimizer does follow the 'waited' access path....for the 'PUBLIC' records.....
It seems that using the analyze table statement does not permit to gather all the necessary statistics.....(that's why it is depreciated)...!!!!
Thanks.....
Sim

Similar Messages

  • XMLIndex: finding indexed XPaths and the number of rows in the path table

    Hi,
    I am storing non-schema-based binary XMLs in an XMLType column in 11g (11.1.0.6.0) and would like to index the XMLs either partially or fully using XMLIndex. I'm expecting to have a large number (tens of millions) of XML documents and have some concerns about the size of the XMLIndex path table.
    In short, I am worried that the path table might grow unmanageable large. In order to avoid this and to plan for table partitioning, I would like to create a report of all indexed XPaths in an XMLIndex and to find out how many times each path is actualized in the path table. I would do this for a representative XML sample.
    I have been creating XMLIndexes with different exclude/include paths, gathering stats with DBMS_STATS (estimate_percent = 100) and selecting the number of rows in the path table through USER_TABLES.
    If anyone knows a more straightforward way of doing this all advice is very much appreciated.
    Best Regards,
    Rasko Leinonen

    Thanks Marco,
    I managed to get out all indexed paths using the following SQL. It took a while to understand how the join the XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5 and XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5 tables together but got there in the end. This helps to clarify which XPaths are being currently indexed by the XMLIndex.
    begin
    for v_row in (select PATH from XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5)
    loop
    declare
    v_i BINARY_INTEGER := 1;
    v_id raw(8);
    v_len BINARY_INTEGER := 2;
    v_skip BINARY_INTEGER := 1;
    begin
    while v_i < utl_raw.length(v_row.path) and
    v_i + v_len <= utl_raw.length(v_row.path)
    loop
    v_i := v_i + v_skip;
    v_id := utl_raw.substr(v_row.path, v_i, v_len);
    --dbms_output.put_line(v_id);
    for v_row2 in (select LOCALNAME, flags from XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5
    where ID = v_id )
    loop
    if rawtohex(v_row2.flags) = '01'
    then
    dbms_output.put('@');
    end if;
    dbms_output.put(v_row2.localname);
    if v_i + v_len < utl_raw.length(v_row.path)
    then
    dbms_output.put('/');
    end if;
    end loop;
    v_i := v_i + v_len;
    end loop;
    dbms_output.put_line('');
    end;
    end loop;
    end;
    Example output:
    RUN
    RUN/@accession
    RUN/@alias
    RUN/@instrument_model
    RUN/@run_date
    RUN/@run_center
    RUN/@total_data_blocks
    RUN/EXPERIMENT_REF
    RUN/EXPERIMENT_REF/@accession
    RUN/EXPERIMENT_REF/@refname
    RUN/DATA_BLOCK
    RUN/DATA_BLOCK/@name
    RUN/DATA_BLOCK/@total_spots
    RUN/DATA_BLOCK/@total_reads
    RUN/DATA_BLOCK/@number_channels
    RUN/DATA_BLOCK/@format_code
    RUN/DATA_BLOCK/@sector
    RUN/DATA_BLOCK/FILES
    RUN/DATA_BLOCK/FILES/FILE
    RUN/DATA_BLOCK/FILES/FILE/@filename
    RUN/DATA_BLOCK/FILES/FILE/@filetype
    RUN/RUN_ATTRIBUTES
    RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE
    RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/TAG
    RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/VALUE

  • Use of Indexes in select query

    Hello,
    This is on a 9i install.
    There is an index called form_id_idx on the form_id column.
    Why does this query use the index (autotrace indicates range scan on the index):
    select count(*) from table_name where form_id=123456;
    but this query does NOT use the index (autotrace indicates full table scan):
    select accepted from table_name where form_id=123456;
    This second query runs much faster when I use a hint on the index. Any help/suggestions?
    Thanks.

    The first query does NOT have to go to the Table it all. It can read the index to count the number of rows for "form_id=123456". An Index Range Scan would be fast.
    The second query has to go to the table to get the values for the "accepted" column for all the rows that have "form_id=123456". Remember that every get can require a read of 2 or more blocks -- at least one, probably 2 or 3, from the index and 1 from the table. If the number of rows is likely to be large then the number of block get operations would be high. In such cases, Oracle computes that it is faster to do a small set of multiblock reads to read the whole table (Table FullScan).
    Therefore, the optimzer weighs :
    a. how many rows it thinks will satisfy "form_id=123456"
    b. how many index + table block gets it would have to execute (all as single block read calls to the OS)
    versus
    x. how many multiblock read calls it thinks it has to execute to read the whole table
    If the available statistics on number of rows, cardinality or density and the size of the table indicate that operation "x" would be cheaper then operations "a" + "b", Oracle would prefer the latter.
    Hemant K Chitale
    http://hemantoracledba.blogspot.com

  • DBMS Gather Stats using ESTIMATE, gives varying number of rows

    I am a little intrigued by the gather_table_stats results for number of rows on user_tables.
    A table with no maintenance on it, has 242115 rows.
    When I gather stats COMPUTE, num_rows from user_tables = 242115.
    However, when I ESTIMATE the figure changes, without apparent reason:
    10% - 240710
    25% - 240564
    50% - 242904
    99% - 242136
    Using ESTAIMTE, I would expect the number of rows that are inspected to change, but not the resulting number of rows on User_tables!
    I wonder, why is this?
    Thanks

    Thank you for that amusing analogy!
    However, it would be interesting to know where it
    gets this idea from. Why does it decide sometimes
    more, sometimes less, what basis?Actually I'm not the person that knows the precise algorithm, I don't know also any links to docs handy that describes how it is done. But one scenario would be to enble trace and check what sql oracle is issuing to gather stats. Of course it won't be all the algorithm, but probably you'll get some insight.
    I mean, If I knew I had not removed or added any
    socks to the wardrobe or even if I was unsure anyone
    else had, I would use the previous count as my
    starting point.AFAIK Oracle doesn't have any previous knowledge i.e. to be more precise Oracle doesn't use it. Because you as a person probably know something more how the table was or wasn't changed, but Oracle doesn't know and/or use such information at least for stats gathering.
    Gints Plivna
    http://www.gplivna.eu

  • New table without statistics returns invalid number of rows

    Hi,
    I've been searching for a while now for an explanation for the following "problem"
    We have an Oracle 11.1.0.7 database on AIX5.3
    In this database we have two tables, called KRT_PRODUCTS_INFO and KRT_STRUCTURES_INFO ( the table name don't really matter ).
    The scenario is as following:
    If we recreate these tables like:
    CREATE TABLE KRT_PRODUCT_INFO_BUP AS SELECT * FROM KRT_PRODUCT_INFO;
    DROP TABLE KRT_PRODUCT_INFO CASCADE CONSTRAINTS;
    CREATE TABLE KRT_PRODUCT_INFO (...) TABLESPACE PIM_DATA NOLOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING;
    CREATE INDEX KRT_PRODUCT_INFO_X1 ON KRT_PRODUCT_INFO (PRODUCT_NUMBER) NOLOGGING TABLESPACE PIM_DATA NOPARALLEL;
    CREATE INDEX KRT_PRODUCT_INFO_X2 ON KRT_PRODUCT_INFO (PIM_ARTICLEREVISIONID) NOLOGGING TABLESPACE PIM_DATA NOPARALLEL;
    INSERT INTO KRT_PRODUCT_INFO (SELECT * FROM KRT_PRODUCT_INFO_BUP);
    COMMIT;
    CREATE TABLE KRT_STRUCTURE_INFO_BUP AS SELECT * FROM KRT_STRUCTURE_INFO;
    DROP TABLE KRT_STRUCTURE_INFO CASCADE CONSTRAINTS;
    CREATE TABLE KRT_STRUCTURE_INFO (...) TABLESPACE PIM_DATA NOLOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING;
    CREATE INDEX KRT_STRUCTURES_X1 ON KRT_STRUCTURE_INFO (STRUCTURE_GRP_REV_ID) NOLOGGING TABLESPACE PIM_DATA NOPARALLEL;
    CREATE INDEX KRT_STRUCTURES_X2 ON KRT_STRUCTURE_INFO (STRUCTURE_GRP_IDENTIFIER) NOLOGGING TABLESPACE PIM_DATA NOPARALLEL;
    CREATE INDEX KRT_STRUCTURES_X3 ON KRT_STRUCTURE_INFO (STRUCTURE_GRP_ID) NOLOGGING TABLESPACE PIM_DATA NOPARALLEL;
    INSERT INTO KRT_STRUCTURE_INFO (SELECT * FROM KRT_STRUCTURE_INFO_BUP);
    COMMIT;
    and we run a complex query with these two tables, this query only return a couple of rows ( exactly 24 !!! )
    If we however generate statistics on these tables after creation, the correct number of rows is returned, being 1.167.991 rows
    The statistics are gathered using:
    BEGIN
    SYS.DBMS_STATS.GATHER_TABLE_STATS (
    OwnName => 'PIM_KRG'
    ,TabName => 'KRT_PRODUCT_INFO'
    ,Estimate_Percent => NULL
    ,Method_Opt => 'FOR ALL COLUMNS SIZE REPEAT '
    ,Degree => NULL
    ,Cascade => TRUE
    ,No_Invalidate => FALSE);
    END;
    BEGIN
    SYS.DBMS_STATS.GATHER_TABLE_STATS (
    OwnName => 'PIM_KRG'
    ,TabName => 'KRT_STRUCTURE_INFO'
    ,Estimate_Percent => NULL
    ,Method_Opt => 'FOR ALL COLUMNS SIZE REPEAT '
    ,Degree => NULL
    ,Cascade => TRUE
    ,No_Invalidate => FALSE);
    END;
    /I can imagine that the 'plan' for the query used is wrong because of missing statistics.
    But I can't imagine that it would actually return an incorrect number of rows.
    I tested this behaviour in Toad and sqlplus ( first thought it was Toad ), and both behave the same.
    Another fact is, that the "problem" is NOT reproducable on our TEST environment, that runs on Oracle 11.1.0.7 on Windows2008
    Just to be sure this is the "complex" query used. It is not developed by me, and I think it looks somewhat strange but that shouldn't matter:
    SELECT sr."Identifier" STRUCTURE_IDENTIFIER
    , ar_i."Identifier" ITEM_NUMBER
    , SUM (REPLACE (NVL (s.HIDE_LE10, 0) + NVL (p.HIDE_LE10, 0), 2, 1))
    hide_le10
    , SUM (REPLACE (NVL (s.HIDE_LE30, 0) + NVL (p.HIDE_LE30, 0), 2, 1))
    hide_le30
    , SUM (REPLACE (NVL (s.HIDE_LE40, 0) + NVL (p.HIDE_LE40, 0), 2, 1))
    hide_le40
    , SUM (REPLACE (NVL (s.HIDE_LE50, 0) + NVL (p.HIDE_LE50, 0), 2, 1))
    hide_le50
    , SUM (REPLACE (NVL (s.HIDE_LE55, 0) + NVL (p.HIDE_LE55, 0), 2, 1))
    hide_le55
    , SUM (REPLACE (NVL (s.HIDE_LE60, 0) + NVL (p.HIDE_LE60, 0), 2, 1))
    hide_le60
    , SUM (REPLACE (NVL (s.HIDE_LE70, 0) + NVL (p.HIDE_LE70, 0), 2, 1))
    hide_le70
    , SUM (REPLACE (NVL (s.HIDE_LE75, 0) + NVL (p.HIDE_LE75, 0), 2, 1))
    hide_le75
    , SUM (REPLACE (NVL (s.HIDE_LE58, 0) + NVL (p.HIDE_LE58, 0), 2, 1))
    hide_le58
    , SUM (REPLACE (NVL (s.HIDE_LE80, 0) + NVL (p.HIDE_LE80, 0), 2, 1))
    hide_le80
    , SUM (REPLACE (NVL (s.HIDE_LE90, 0) + NVL (p.HIDE_LE90, 0), 2, 1))
    hide_le90
    , SUM (REPLACE (NVL (s.HIDE_LE92, 0) + NVL (p.HIDE_LE92, 0), 2, 1))
    hide_le92
    , SUM (REPLACE (NVL (s.HIDE_LE94, 0) + NVL (p.HIDE_LE94, 0), 2, 1))
    hide_le94
    , SUM (REPLACE (NVL (s.HIDE_LE96, 0) + NVL (p.HIDE_LE96, 0), 2, 1))
    hide_le96
    , COUNT (*) cnt
    FROM KRAMP_HPM_MAIN."StructureRevision" sr
    , KRAMP_HPM_MAIN."StructureGroupRevision" sgr
    , KRAMP_HPM_MASTER."ArticleStructureMap" asm
    , KRAMP_HPM_MASTER."ArticleRevision" ar_p
    , KRAMP_HPM_MASTER."ArticleDetail" ad_p
    , KRAMP_HPM_MASTER."ArticleRevision" ar_i
    , KRAMP_HPM_MASTER."ArticleDetail" ad_i
    , KRAMP_HPM_MASTER."ArticleReference" ar
    , KRT_STRUCTURE_INFO s
    , KRT_PRODUCT_INFO p
    WHERE sr."StructureID" = sgr."StructureID"
    AND sgr."StructureGroupID" = asm."StructureGroupID"
    AND ar_p."ID" = asm."ArticleRevisionID"
    AND ar_p."ID" = ad_p."ArticleRevisionID"
    AND ad_p."Res_Text100_02" = 'PRODUCT'
    AND ar_i."ID" = ad_i."ArticleRevisionID"
    AND ad_i."Res_Text100_02" = 'ARTICLE'
    AND ar."ArticleRevisionID" = ar_p."ID"
    AND ar."ReferencedSupplierAID" = ar_i."Identifier"
    AND s.STRUCTURE_GRP_REV_ID = sgr."ID"
    AND p.PIM_ARTICLEREVISIONID = ar_p."ID"
    GROUP BY sr."Identifier", ar_i."Identifier";Any ideas are welcome..
    Thanks
    FJFranken

    Hemant K Chitale wrote:
    These two tables are in the PIM_KRG schema while the other tables in the query are distributed across two other schemas "KRAMP_HPM_MAIN" and "KRAMP_HPM_MASTER" ?
    Do you happen to have the same table names occurring in multiple schemas - the query is then referencing the data in the wrong schema ?
    Hemant K ChitaleHi,
    This is not the case. The KRAMP_HPM schema's are application dedicated schema's
    And this also then does not explain why the results are correct after generating statistics.
    Anyway thanks for the tip.
    FJFranken

  • Get the number of rows returned by a dataProvider

    hi
    I am using a [Bindable] variable that I am setting and using
    as a DataProvider (coming from a web service) for a DataGrid within
    my Flex 2 application.
    is there a way of knowing the amount of rows that the
    dataProvider is returning???
    as I want to do a calculation to set the height of the
    dataGrid depending on the amount of rows being returned by the
    dataGrid!
    any suggestions...?
    Thanks,
    Jon.

    that only seems to count the default number of rows (height)
    of the datagrid..... i.e. 7.
    I need to know the number of rows being returned from the
    dataProvider - i.e. the number of rows coming through the
    webService from the database etc.....
    Thanks,
    Jon.

  • Find number of rows in  a cursor

    How can i find how many rows are in a cursor. I have a situation if my cursor only retruns one row i return the data if it returns more then one row i will need to do additional select.

    If you have logic like this
    SELECT COUNT(*)
      INTO l_cnt
      FROM emp
    WHERE deptno = p_deptno;
    IF( l_cnt > 1 )
    THEN
      FOR x IN (SELECT * FROM emp WHERE deptno = p_deptno)
      LOOP
        ..where you are counting the rows and then later fetching them, getting the count and then getting the rows will force Oracle to do the work of the query twice. It will also potentially cause logic errors because the number of rows returned by the COUNT(*) won't necessarily match the number of rows fetched from the cursor because some other session may have committed changes between your session executing those two statements.
    Can you describe the logic you are trying to implement in a bit more detail? There are potentially a number of different approaches depending on exactly what you are trying to do. Sometimes it may make sense to do a COUNT(*), sometimes it may make sense to fetch the data into a collection, count the collection elements, and then operate on the collection, sometimes it may make sense to do a SELECT INTO and handle the exception if the wrong number of rows are returned, etc.
    Justin

  • Using a For Loop Index for Array Element Number?

    Hi.  Thanks in advance for the help.  I can't seem to find what I want to do here using the search function... probably because I don't know how to frame the question appropriately.  Ignore the title to this post cause it's probably wrong vocabulary for what I want to do.
    Here's the situation:
    I have a 2D array where the first column is the X data and each subsequent column is Y data (call it Y1...Yn).  The n-value varies from run to run (some runs have 4 columns of data, some have 20), but that is easily gathered when reading the data file.  I need to perform a number of operations on each set of data, the least of which is smoothing the data and graphing it, so I'm limiting my discussion to these 2 operations.
    What I want is a for loop structure where the indexing of the loop tracks the Y1...Yn columns, grabs each column for the iteration, performs the relevant analysis, and spits out the result, but in a stackable manner.  Thus the title; I want to use the for loop's index to mark the array element for building a new array.
    See the image attached.  A 2D array of 9 columns (X, Y1...Y8) is analyzed such that each data set, (X, Y1), (X, Y2)...(X, Y8) is bundled, graphed, run through a B-spline Fit, of which is also graphed.  I need to replace this with something that looks like the for loop structure shown.  
    I just don't know how to get those two data bundles [(X, Yi) and it's smoothed pair] out of the for loop in a stacked set from every iteration of the for loop.
    Again the title, I think I want to build a new array where i use the index of the for loop to control the entries of the new array.  But I can't see how to do that.
    Any help would be appreciated.
    Attachments:
    NeedForLoopForThis.PNG ‏30 KB

    Hello H.R. Dunham, and welcome to the forum!
    It seems that you may be looking for Auto-Indexing, a basic feature of loops in LabVIEW.  You'll need to transpose your array before wiring it into the for loop, as elements are auto-indexed by row before column, but at that point you should be able to operate on each column and output an array of n cluster elements corresponding to your input columns.  Auto-indexing tunnels look like brackets to indicate each element will be indexed automatically- this should be the default when wiring an array into a for loop or when wiring anything out of a for loop.
    As for how to build your pairs, I suggest removing the X column and creating a "starter" cluster containing your X data and placeholder Y data before entering your "Y" processing loop.  Use the bundle by name function in the for loop to insert your processed column data into the cluster and auto-index the cluster output. Flow would be something like this:
    1) Gather data
    2) Split X and Y using standard array operations
    3) Create "template" cluster with shared X data
    4) Pass template cluster and Y-column array into an auto-indexed for loop.
    5) Insert processed Y data into cluster inside loop.
    6) Auto-index cluster data out of loop.
    This tutorial is probably also a good place to get started:
    Getting Started with NI LabVIEW Module 3: Loops
    http://www.ni.com/white-paper/7528/en/
    Hope that helps!
    Regards,
    Tom L.

  • Why does not my query use an index?

    I have a table with some processed rows (state: 9) and some unprocessed rows (states: 0,1,2,3,4).
    This table has over 120000 rows, but this number will grow.
    Most of the rows are processed and most of them also contain a group id. Number of groups is relatively small (let's assume 20).
    I would like to obtain the oldest some_date for every group. This values has to be outer joined to a on-line report (contains one row for each group).
    Here is my set-up:
    Tested on: 10.2.0.4 (Solaris), 10.2.0.1 (WinXp)
    drop table t purge;
    create table t(
      id number not null primary key,
      grp_id number,
      state number,
      some_date date,
      pad char(200)
    insert into t(id, grp_id, state, some_date, pad)
    select level,
         trunc(dbms_random.value(0,20)),
            9,
            sysdate+dbms_random.value(1,100),
            'x'
    from dual
    connect by level <= 120000;
    insert into t(id, grp_id, state, some_date, pad)
    select level + 120000,
         trunc(dbms_random.value(0,20)),
            trunc(dbms_random.value(0,5)),
            sysdate+dbms_random.value(1,100),
            'x'
    from dual
    connect by level <= 2000;
    commit;
    exec dbms_stats.gather_table_stats(user, 'T', estimate_percent=>100, method_opt=>'FOR ALL COLUMNS SIZE 1');
    Tom Kyte's printtab
    ==============================
    TABLE_NAME                    : T
    NUM_ROWS                      : 122000
    BLOCKS                        : 3834I know, this could be easily solved by fast refresh on commit materialized view like this:
    select
      grp_id,
      min(some_date),
    from
      t
    where
      state in (0,1,2,3,4)
    grpup by
      grp_id;+ I have to create log on (grp_id, some_date, state)
    Number of rows with active state will be always relatively small. Let's assume 1000-2000.
    So my another idea was to create a selective index. An index which would contain only data for rows with an active state.
    Something like this:
    create index fidx_active on t ( 
      case state 
        when 0 then grp_id
        when 1 then grp_id
        when 2 then grp_id
        when 3 then grp_id
        when 4 then grp_id
      end,
      case state
        when 0 then some_date
        when 1 then some_date
        when 2 then some_date
        when 3 then some_date
        when 4 then some_date
      end) compress 1; so a tuple (group_id, some_date) is projected to tuple (null, null) when the state is not an active state and therefore it is not indexed.
    We can save even more space by compressing 1st expression.
    analyze index idx_grp_state_date validate structure;
    select * from index_stats
    @pr
    Tom Kyte's printtab
    ==============================
    HEIGHT                        : 2
    BLOCKS                        : 16
    NAME                          : FIDX_ACTIV
    LF_ROWS                       : 2000 <-- we're indexing only active rows
    LF_BLKS                       : 6 <-- small index: 1 root block with 6 leaf blocks
    BR_ROWS                       : 5
    BR_BLKS                       : 1
    DISTINCT_KEYS                 : 2000
    PCT_USED                      : 69
    PRE_ROWS                      : 25
    PRE_ROWS_LEN                  : 224
    OPT_CMPR_COUNT                : 1
    OPT_CMPR_PCTSAVE              : 0Note: @pr is a Tom Kyte's print table script adopted by Tanel Poder (I'm using Tanel's library) .
    Then I created a query to be outer joined to the report (report contains a row for every group).
    I want to achieve a full scan of the index.
    select
      case state -- 1st expression
        when 0 then grp_id
        when 1 then grp_id
        when 2 then grp_id
        when 3 then grp_id
        when 4 then grp_id
      end grp_id,
      min(case state --second expression
            when 0 then some_date
            when 1 then some_date
            when 2 then some_date
            when 3 then some_date
            when 4 then some_date
          end) as mintime
    from t 
    where
      case state --1st expression: at least one index column has to be not null
        when 0 then grp_id
        when 1 then grp_id
        when 2 then grp_id
        when 3 then grp_id
        when 4 then grp_id
      end is not null
    group by
      case state --1st expression
        when 0 then grp_id
        when 1 then grp_id
        when 2 then grp_id
        when 3 then grp_id
        when 4 then grp_id
      end;-------------
    Doc's snippet:
    13.5.3.6 Full Scans
    A full scan is available if a predicate references one of the columns in the index. The predicate does not need to be an index driver. A full scan is also available when there is no predicate, if both the following conditions are met:
    All of the columns in the table referenced in the query are included in the index.
    At least one of the index columns is not null.
    A full scan can be used to eliminate a sort operation, because the data is ordered by the index key. It reads the blocks singly.
    13.5.3.7 Fast Full Index Scans
    Fast full index scans are an alternative to a full table scan when the index contains all the columns that are needed for the query, and at least one column in the index key has the NOT NULL constraint. A fast full scan accesses the data in the index itself, without accessing the table. It cannot be used to eliminate a sort operation, because the data is not ordered by the index key. It reads the entire index using multiblock reads, unlike a full index scan, and can be parallelized.
    You can specify fast full index scans with the initialization parameter OPTIMIZER_FEATURES_ENABLE or the INDEX_FFS hint. Fast full index scans cannot be performed against bitmap indexes.
    A fast full scan is faster than a normal full index scan in that it can use multiblock I/O and can be parallelized just like a table scan.
    So the question is: Why does oracle do a full table scan?
    Everything needed is in the index and one expression is not null, but index (fast) full scan is not even considered by CBO (I did a 10053 trace)
    | Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  HASH GROUP BY     |      |      1 |     85 |     20 |00:00:00.11 |    3841 |
    |*  2 |   TABLE ACCESS FULL| T    |      1 |   6100 |   2000 |00:00:00.10 |    3841 |
    Predicate Information (identified by operation id):
       2 - filter(CASE "STATE" WHEN 0 THEN "GRP_ID" WHEN 1 THEN "GRP_ID" WHEN 2
                  THEN "GRP_ID" WHEN 3 THEN "GRP_ID" WHEN 4 THEN "GRP_ID" END  IS NOT NULL)Let's try some minimalistic examples. Firstly with no FBI.
    create index idx_grp_id on t(grp_id);
    select grp_id,
           min(grp_id) min
    from t
    where grp_id is not null
    group by grp_id;
    | Id  | Operation             | Name       | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   1 |  HASH GROUP BY        |            |      1 |     20 |     20 |00:00:01.00 |     244 |    237 |
    |*  2 |   INDEX FAST FULL SCAN| IDX_GRP_ID |      1 |    122K|    122K|00:00:00.54 |     244 |    237 |
    Predicate Information (identified by operation id):
       2 - filter("GRP_ID" IS NOT NULL)This kind of output I was expected to see with FBI. Index FFS was used although grp_id has no NOT NULL constraint.
    Let's try a simple FBI.
    create index fidx_grp_id on t(trunc(grp_id));
    select trunc(grp_id),
           min(trunc(grp_id)) min
    from t
    where trunc(grp_id) is not null
    group by trunc(grp_id);
    | Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  HASH GROUP BY     |      |      1 |     20 |     20 |00:00:00.94 |    3841 |
    |*  2 |   TABLE ACCESS FULL| T    |      1 |   6100 |    122K|00:00:00.49 |    3841 |
    Predicate Information (identified by operation id):
       2 - filter(TRUNC("GRP_ID") IS NOT NULL)Again, index (fast) full scan not even considered by CBO.
    I tried:
    alter table t modify grp_id not null;
    alter table t add constraint trunc_not_null check (trunc(grp_id) is not null);I even tried to set table hidden column (SYS_NC00008$) to NOT NULL
    It has no effect, FTS is still used..
    Let's try another query:
    select distinct trunc(grp_id)
    from t
    where trunc(grp_id) is not null
    | Id  | Operation             | Name        | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  HASH UNIQUE          |             |      1 |     20 |     20 |00:00:00.85 |     244 |
    |*  2 |   INDEX FAST FULL SCAN| FIDX_GRP_ID |      1 |    122K|    122K|00:00:00.49 |     244 |
    Predicate Information (identified by operation id):
       2 - filter("T"."SYS_NC00008$" IS NOT NULL)Here the index FFS is used..
    Let's try one more query, very similar to the above query:
    select trunc(grp_id)
    from t
    where trunc(grp_id) is not null
    group by trunc(grp_id)
    | Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  HASH GROUP BY     |      |      1 |     20 |     20 |00:00:00.86 |    3841 |
    |*  2 |   TABLE ACCESS FULL| T    |      1 |    122K|    122K|00:00:00.49 |    3841 |
    Predicate Information (identified by operation id):
       2 - filter(TRUNC("GRP_ID") IS NOT NULL)And again no index full scan..
    So my next question is:
    What are the restrictions which prevent index (fast) fullscan to be used in these scenarios?
    Thank you very much for your answers.
    Edited by: user1175494 on 16.11.2010 15:23
    Edited by: user1175494 on 16.11.2010 15:25

    I'll start off with the caveat that i'm no Johnathan Lewis so hopefully someone will be able to come along and give you a more coherent explanation than i'm going to attempt here.
    It looks like the application of the MIN function against the case statement is confusing the optimizer and disallowing the usage of your FBI. I tested this against my 11.2.0.1 instance and your query chooses the fast full scan without being nudged in the right direction.
    That being said, i was able to get this to use a fast full scan on my 10 instance, but i had to jiggle the wires a bit. I modified your original query slightly, just to make it easier to do my fiddling.
    original (in the sense that it still takes the full table scan) query
    with data as
      select
        case state -- 1st expression
          when 0 then grp_id
          when 1 then grp_id
          when 2 then grp_id
          when 3 then grp_id
          when 4 then grp_id
        end as grp_id,
        case state --second expression
              when 0 then some_date
              when 1 then some_date
              when 2 then some_date
              when 3 then some_date
              when 4 then some_date
        end as mintime
      from t
      where
        case state --1st expression: at least one index column has to be not null
          when 0 then grp_id
          when 1 then grp_id
          when 2 then grp_id
          when 3 then grp_id
          when 4 then grp_id
        end is not null
      and
        case state --second expression
              when 0 then some_date
              when 1 then some_date
              when 2 then some_date
              when 3 then some_date
              when 4 then some_date
        end is not null 
    select--+ GATHER_PLAN_STATISTICS
      grp_id,
      min(mintime)
    from data
    group by grp_id;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'allstats  +peeked_binds'));
    | Id  | Operation        | Name | Starts | E-Rows | A-Rows |      A-Time   | Buffers |
    |   1 |  HASH GROUP BY        |       |      2 |      33 |       40 |00:00:00.07 |    7646 |
    |*  2 |   TABLE ACCESS FULL| T       |      2 |      33 |     4000 |00:00:00.08 |    7646 |
    Predicate Information (identified by operation id):
       2 - filter((CASE "STATE" WHEN 0 THEN "GRP_ID" WHEN 1 THEN "GRP_ID" WHEN 2
               THEN "GRP_ID" WHEN 3 THEN "GRP_ID" WHEN 4 THEN "GRP_ID" END  IS NOT NULL AND
               CASE "STATE" WHEN 0 THEN "SOME_DATE" WHEN 1 THEN "SOME_DATE" WHEN 2 THEN
               "SOME_DATE" WHEN 3 THEN "SOME_DATE" WHEN 4 THEN "SOME_DATE" END  IS NOT
               NULL))
    modified version where we prevent the MIN function from being applied too early, by using ROWNUM
    with data as
      select
        case state -- 1st expression
          when 0 then grp_id
          when 1 then grp_id
          when 2 then grp_id
          when 3 then grp_id
          when 4 then grp_id
        end as grp_id,
        case state --second expression
              when 0 then some_date
              when 1 then some_date
              when 2 then some_date
              when 3 then some_date
              when 4 then some_date
        end as mintime
      from t
      where
        case state --1st expression: at least one index column has to be not null
          when 0 then grp_id
          when 1 then grp_id
          when 2 then grp_id
          when 3 then grp_id
          when 4 then grp_id
        end is not null
      and
        case state --second expression
              when 0 then some_date
              when 1 then some_date
              when 2 then some_date
              when 3 then some_date
              when 4 then some_date
        end is not null 
      and rownum > 0
    select--+ GATHER_PLAN_STATISTICS
      grp_id,
      min(mintime)
    from data
    group by grp_id;
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'allstats  +peeked_binds'));
    | Id  | Operation           | Name        | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  HASH GROUP BY           |            |      2 |     20 |     40 |00:00:00.01 |      18 |
    |   2 |   VIEW                |            |      2 |     33 |   4000 |00:00:00.07 |      18 |
    |   3 |    COUNT           |            |      2 |      |   4000 |00:00:00.05 |      18 |
    |*  4 |     FILTER           |            |      2 |      |   4000 |00:00:00.03 |      18 |
    |*  5 |      INDEX FAST FULL SCAN| FIDX_ACTIVE |      2 |     33 |   4000 |00:00:00.01 |      18 |
    Predicate Information (identified by operation id):
       4 - filter(ROWNUM>0)
       5 - filter(("T"."SYS_NC00006$" IS NOT NULL AND "T"."SYS_NC00007$" IS NOT NULL))

  • Why isn't my query using the index?

    I have a query that inserts values for engines in a grid; it uses a static date table to determine the day in week, or
    week in year (depending on different standards, the DBA can configure this table to their business's likings). I have
    two indexes on this table:
    create table d_date (
         date_key number(5) not null,
         sql_calendar_date timestamp(3) null,
         year_id number(5) null,
         month_id number(3) null,
         day_id number(3) null,
         year_end_biz_date timestamp(3) null,
         qtr_end_biz_date timestamp(3) null,
         month_end_biz_date timestamp(3) null,
         week_end_biz_date timestamp(3) null,
         quarter_id number(3) null,
         week_id number(3) null,
         day_in_year number(5) null,
         day_in_month number(3) null,
         day_in_week number(3) null,
         month_name char(3) null,
         day_in_week_name char(3) null,
         month_type_code char(1) null,
         week_type_code char(1) null,
         date_type_code char(1) null,
         weekend_flag char(1) null,
         holiday_flag char(1) null,
         from_datetime timestamp(3) null,
         to_datetime timestamp(3) null,
         current_flag char(1) null,
         constraint d_date_pkey primary key (date_key)
         ) tablespace dim;
    create index d_date_dy on d_date(year_id, day_in_year) tablespace_dim_idx;
    create index d_date_ww on d_date(year_id, week_id) tablespace_dim_idx;Now, when I run a query to insert the week id into a table based on two values, the year_key and day_in_year_key,
    it should use the d_date_dy index correct?
    Here is what the query looks like:
    INSERT INTO F_ENGINE (YEAR_KEY,MONTH_KEY,WEEK_IN_YEAR_KEY,DAY_IN_YEAR_KEY,DAY_IN_MONTH_KEY,HOUR_IN_DAY_KEY, Q_HOUR_IN_DAY_KEY,
      GRID_KEY,ENGINE_KEY,TIME_STAMP,ENGINE_CPU_UTIL,ENGINE_CPU_GRID_UTIL,MEMORY_TOTAL_BYTE, MEMORY_FREE_BYTE,DISK_FREE_MEGABYTE,
      PROCESS_COUNT,ENGINE_ID,GRID_ID,GRID_NAME,BATCH_ID,RECORD_VIEWABLE_F)
    SELECT EXTRACT(YEAR FROM START_DATETIME),EXTRACT(MONTH FROM START_DATETIME), DD.WEEK_ID,
      TO_NUMBER(TO_CHAR(START_DATETIME, 'DDD')), EXTRACT(DAY FROM START_DATETIME),EXTRACT(HOUR FROM START_DATETIME),
      FLOOR(EXTRACT(MINUTE FROM START_DATETIME)/15)*15,DG.GRID_KEY,DE.ENGINE_KEY, START_DATETIME,CPU_UTIL,DS_CPU,MEMORY,
      FREE_MEMORY,FREE_DISK,PROCESSES,ID,PE.GRID,DG.GRID_NAME,:B1 ,1
    FROM P_ENGINE PE, D_GRID DG, D_ENGINE DE, D_DATE DD
    WHERE PE.GRID = DG.GRID_ID AND DG.CURRENT_FLAG = 'Y' AND PE.ID = DE.ENGINE_ID AND DE.GRID_KEY = DG.GRID_KEY AND
      DE.CURRENT_FLAG = 'Y' AND PE.BATCH_ID = :B1 AND DD.YEAR_ID = EXTRACT(YEAR FROM START_DATETIME) AND
    DD.DAY_IN_YEAR = TO_NUMBER(TO_CHAR(START_DATETIME,'DDD'))
    ORDER BY EXTRACT(YEAR FROM START_DATETIME),EXTRACT(MONTH FROM START_DATETIME),
      EXTRACT(DAY FROM START_DATETIME),EXTRACT(HOUR FROM START_DATETIME),FLOOR(EXTRACT(MINUTE FROM START_DATETIME)/15)*15,
      DG.GRID_KEY,DE.ENGINE_KEY
    Here is the explain plan:
    Operation Object Object Type Order Rows Size (KB) Cost Time (sec) CPU Cost I/O Cost
    INSERT STATEMENT
    SORT ORDER BY
         HASH JOIN
           HASH JOIN
             HASH JOIN
              TABLE ACCESS FULL D_GRID TABLE 1 2 0.316 3 1 36887 3
              TABLE ACCESS FULL D_ENGINE TABLE 2 10 0.410 3 1 42607 3
             PARTITION LIST SINGLE   5 1434 344.496 9 1 2176890 9
              TABLE ACCESS FULL P_ENGINE TABLE 4 1434 344.496 9 1 2176890 9
                TABLE ACCESS FULL D_DATE TABLE 7 7445 283.550 19 1 3274515 18Now it is obviously not using the index for the d_date table since it is doing a full table access.
    Does this have something to do with the fact that I am using extract(), to_number(), to_char() functions in my WHERE clause that it is not allowing the use of the index?
    Any help would be greatly appreciated. Thanks.
    -Tim

    It's difficult to tell just from this. For one thing, you didn't post your query using the forum format tags, so it's hard to read and you didn't post your Oracle version.
    In the query, you don't always prefix columns with the table alias. That makes it impossible for us (and maintainers of this code) to know at a glance which table a column is in.
    It's possible that performing functions on a column will disable the index. Do your other tables have indexes? Do you have updated statistics on all the tables?
    The main reason the optimizer will not use an index is because it thinks it cheaper not to.

  • How to force the optimaizer to stop using an index ?

    Hello,
    I have an index on a very large table and I want to see how the applications running on this DB handles a situation in which this index does not exists.
    Therfore I have 2 options:
    1. drop the index - but this is too risky as if i will need to recreate it , it will last forever and will result in long application downtime which I can not afford.
    The test and Dev environments does not contain ammounts of data like the prodicution so its hard to predict from these environments.
    2. the second option is Modify the index columns statistics (which I have done) giving it low NDV (number of diftinct values) -- but sadly this did not work.
    when cheking event 10053 I see a the line "Using prorated density: [ 1/(2*num_rows) ] of col #n as selectivity of out-of-range value pred" which I guess meens the High value of the column is lower then the value given it the query ( I do not run statistics every day , the current statistics for all columns (execpt this one ) suits best and I do not want to handle plan changes . also it will take a lot of time to gather table stats on daily basis.
    So - to make a long story short - how do I force Oracle to avoid using an index but continue builing it and without dropping it?
    I can not use the 'NO_INDEX' hint as it will requre change in many Applications.
    I don need something like NO_INDEX hint on system level.
    I am using Oracle 10g Enterprise edition.
    the optimaized_mode is set to COST BASED.
    Thanks in advance for any help resolving this complicated issue.
    Regards,
    Amit Zor.
    ADBA.

    user3698066 wrote:
    Hello,
    I have an index on a very large table and I want to see how the applications running on this DB handles a situation in which this index does not exists.
    2. the second option is Modify the index columns statistics (which I have done)
    I'm still wondering if there is a way of modifying the statistics of the index in such a way so that it is not used by the optimizer.
    Since the main contributors of the formula for an simple b-tree index access path are the height of index, the number of leaf blocks and for the table access the clustering factor, may be you could come up with all those values bumped up to very large values for that particular index.
    Unfortunately the only component of the formula that is not multiplied by a factor is the height of the index, which is sanity checked (at least in 10.2) when set manually and is limited to a (already quite unreasonable) 255, so you can't set it greater than 255, but the remaining attributes can be set more or less to whatever you want.
    So you could come up with an manual modification of the index statistics like this. Note that I don't modify the NUM_ROWS and DISTINCT_KEYS values in an attempt to limit the risk of unwanted side effects of this modification.
    begin dbms_stats.set_index_stats(
    ownname=>'<index_owner>,
    indname=>'<index_name>',
    indlevel=>255,
    numlblks=>1000000000,
    clstfct=>1000000000,
    avglblk=>1000000000/<num_distinct>,
    avgdblk=>1000000000);
    end;
    /In a quick test I was successfully able to prevent a very selective index access path using these settings, but depending on your remaining statistics and the access paths chosen by the optimizer this might not work for you, at least not in all possible cases, e.g. an index unique scan won't cost more than 256 even using these settings because only a single leaf block by definition has to be visited in this case.
    Of course I haven't checked thoroughly what other side effects this statistics fudging does have, so use at your own risk resp. test it in your non-production environment before even thinking about applying it to an production system.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • About the number of rows used to map data in Xcelsius

    Hi Everyone:
    I am using web services to fetch data into Xcelsius. The information I got from web service will increase in time and what I suppose is when I run out of rows to get all data I must open my Xcelsius model and select a greater range of rows on each component to get all the data that the web service is bringing.
    Is there an alternative to avoid modifying ranges of data in crontrollers when rows mapped are not enough for the data you are fetching from a web service?
    It is a bit confusing, I hope I've been clear enough. I really really will appreciate your opinions. If possible give me technical explanations.
    Thank you,
    Skull
    Edited by: skull_buck on Aug 6, 2009 7:40 PM

    Hi Greg
    Thanks for your fast reply.
    What you suggested is exactly what I am doing now, and also I increased the number of rows allowed to map en Xcelsius which are 512 by default.
    I would like to know now, how many rows are advisable to increase? Because I am using some components and you must specify for each one a certain number of rows.
    I test mapping 3000 and even 6000 rows but the model is too slow and I was not able to export the swf file in any format.
    Thank you again,
    Skull

  • How to use cfloop index value as part of another variable

    Hello,
    I have a RATE form that first asks "how many rates will you
    be adding?" that answer generates a series of form elements based
    on the answer. You then have a form grid to populate, 3 values for
    each rate (price, code, name).
    This part works fine. The issue is now I need to INSERT the
    values into the table, so I need to use the INDEX value of the
    cfloop to recreate the amount (and names) of the fields in the
    INSERT statement. How do I escape, or re-create the evaluated form
    elements ( in which their count is #i# as the loop goes) when I
    need to evaluate for #i# AND evaluate for #form.sku_i_name# at the
    same pass?
    I am passing, for example, #form.sku_2_Name# where that might
    equal "Half Page". The number 2 in that variable was assigned
    during the form creation by the current index of a cfloop. Since my
    action (insert) page does not know how many (out of 50 possible)
    sku's are coming, how do I use the skuCount (another hidden value
    passed as well) to create a proper INSERT SQL command when I need
    to eval the form element and the index at the same time?
    Obviously #sku_#i#_Name# does not work, and #sku_i_Name# does
    not either... I know this can be done, and that I am just doing it
    wrong.
    Thanks for any help!

    bigbrain28 wrote:
    > Thank You, cfsearching! I don't quite understand 100%
    how it works
    As all three of us indicated you use array notation for this
    type of
    requirement. In ColdFusion you can use array notation or dot
    notation
    to access structure data. Almost all data in ColdFusion is
    now some
    type of structure.
    I.E. #Form['myField']# is the same as #Form.myField#.
    The advantage is that with array notation you can do things
    you can not
    do with dot notation. You can reference elements that have
    keys that
    are illegal variable names such as one with a space.
    I.E. #url['my field'] is allowed, #url.my field# would fail
    or course.
    And you can concatenate the key string as we did with your
    example.
    I.E. #Form['aString' & aVariable]#
    There are many powerful things one can do with this
    knowledge. One can
    access record sets with array notations. This can allow for
    very
    sophisticated parsing of a record set.
    I.E. #myQuery['column'][row]#
    You can dynamical call a variable. Thus creating dynamic code
    that does
    not even need to know what variables exist until run time.
    I.E. #variables[anyName]#
    This just scratches the surface.

  • What is use of index by binaary_integer

    Hi All,
    I have created to program of collection where we use index by binaary_integer in one program and not use index by binaary_integer in second program, but result is same, any body help me what is use of index by binaary_integer here
    1- Declare
    Type emp_table_type is table of
    emp%rowtype index by binary_integer;
    my_emp_table emp_table_type;
    Begin
    select * bulk collect into my_emp_table from emp;
    for i in my_emp_table.first..my_emp_table.last
    loop
    dbms_output.put_line(my_emp_table(i).ename);
    end loop;
    end;
    2- Declare
    Type emp_table_type is table of
    emp%rowtype;
    my_emp_table emp_table_type;
    Begin
    select * bulk collect into my_emp_table from emp;
    for i in my_emp_table.first..my_emp_table.last
    loop
    dbms_output.put_line(my_emp_table(i).ename);
    end loop;
    end;
    your suggestion would be greatly appreciated.

    here is one for you.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/composites.htm#CHDEIDIC

  • When using Live View, site looks great, browser testing goes crazy

    I am creating a new website (and I am really unexperienced with Dreamwaver CS5).  But when I check my site using "Live View" everything looks great, the way it is supposed to.  Then when I go to test it in my browswer (Primary browser is Chrome) it goes crazy:  I at first noticed that I had saved one copy as an .asp but then resaved it to .xhtml  I did delete the first line of code already that the .asp file created as it kept giving me an error on line 1.
    Then I tried to do a spry drop-down menu bar, which I have deleted since I thought I was doing something wrong with that and I should just stick to what I half-way know.
    If I were to preview the template page it gives me this error:
    This page contains the following errors:
    error on line 150 at column 76: error parsing attribute name
    Below is a rendering of the page up to the first error.
    Here is line 150:
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    If I were to test the index.xhtml page in the browser, it ignores most images (all but one), and the first nav-bar (an editable region) appears to the left instead of under the header.  The layout is totally ignored and everything is on the left-hand side of the screen instead of in a two column layout.
    I am not testing this on a server just off of my computer.
    I am assuming that the error has something to do with the .asp file I first did and when I resaved it, since I don't know what I would be looking for, is still in there screwing it up.
    Here is the code from the template page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>Midwest Window Brokers | Page</title>
    <!-- TemplateEndEditable -->
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    <style type="text/css">
    <!--
    body {
              font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
              margin: 0;
              padding: 0;
              color: #000;
              background-image: url(/images/bkg.jpg);
              background-repeat: repeat;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
              padding: 0;
              margin: 0;
    h1, h2, h3, h4, h5, h6, p {
              margin-top: 0;           /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
              padding-right: 15px;
              padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
              text-align: left;
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
              border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
              color: #060;
              text-decoration: none; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
              color: #666;
              text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
              text-decoration: none;
    /* ~~this fixed width container surrounds the other divs~~ */
    .container {
              width: 960px;
              background: #FFF;
              margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
    /* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
    .header {
              background-color: #FFF;
    /* ~~ These are the columns for the layout. ~~
    1) Padding is only placed on the top and/or bottom of the divs. The elements within these divs have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
    2) No margin has been given to the columns since they are all floated. If you must add margin, avoid placing it on the side you're floating toward (for example: a right margin on a div set to float right). Many times, padding can be used instead. For divs where this rule must be broken, you should add a "display:inline" declaration to the div's rule to tame a bug where some versions of Internet Explorer double the margin.
    3) Since classes can be used multiple times in a document (and an element can also have multiple classes applied), the columns have been assigned class names instead of IDs. For example, two sidebar divs could be stacked if necessary. These can very easily be changed to IDs if that's your preference, as long as you'll only be using them once per document.
    4) If you prefer your nav on the left instead of the right, simply float these columns the opposite direction (all left instead of all right) and they'll render in reverse order. There's no need to move the divs around in the HTML source.
    .sidebar1 {
              float: right;
              width: 300px;
              background: #ffffff;
              padding-bottom: 10px;
    .content {
              padding: 10px 0;
              width: 650px;
              float: right;
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
              padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    ul.nav {
              list-style: none; /* this creates the space between the navigation on the content below */
    ul.nav li {
              border-bottom: 1px solid #666; /* this creates the button separation */
    ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
              padding: 5px 5px 5px 15px;
              display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
              width: 160px;  /*this width makes the entire button clickable for IE6. If you don't need to support IE6, it can be removed. Calculate the proper width by subtracting the padding on this link from the width of your sidebar container. */
              text-decoration: none;
              background-color: #DDDECB;
    ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
              background: #ADB96E;
              color: #FFF;
    /* ~~ The footer ~~ */
    .footer {
              padding: 10px 0;
              position: relative;/* this gives IE6 hasLayout to properly clear */
              clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
              background-color: #DDDECB;
              font-size: small;
    /* ~~ miscellaneous float/clear classes ~~ */
    .fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
              float: right;
              margin-left: 8px;
    .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
              float: left;
              margin-right: 8px;
    .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */
              clear:both;
              height:0;
              font-size: 1px;
              line-height: 0px;
    #h-navbar {
              font-weight: bold;
              height: auto;
              font-size: 18px;
              line-height: 50px;
              background-image: url(/images/navbar2.jpg);
    #h-navbar1 {
              background-image: none;
              background-repeat: repeat-x;
    -->
    </style>
    <script type="text/javascript">
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    </script>
    </head>
    <body onload="MM_preloadImages('/images/home2.jpg')">
    <div class="container">
      <div class="header"><a href="/index.xhtml"><img src="../images/heading.jpg" alt="Midwest Window Brokers, Windows, Siding, Roofing, 605-791-5352" name="Insert_logo" width="950" height="200" align="right" id="Insert_logo" style="background: #FFFFFF; display:block;" /></a>
        <div id="h-navbar1"><a href="/index.xhtml"><img src="/images/home.jpg" alt="home" width="159" height="51" id="Image1" onmouseover="MM_swapImage('Image1','','/images/home2.jpg',1)" onmouseout="MM_swapImgRestore()" /></a><a href="/windows.html"><img src="/images/services.jpg" width="151" height="51" alt="services" /></a><a href="/freebay.xhtml"><img src="/images/specials.jpg" width="153" height="51" alt="specials" /></a><a href="/gallery.html"><img src="/images/gallery.jpg" width="152" height="51" alt="gallery" /></a><a href="/roofing.xhtml"><img src="/images/order.jpg" width="152" height="51" alt="order" /></a><img src="/images/blank.jpg" width="75" height="51" /><img src="/images/facebook.jpg" width="38" height="51" alt="facebook" longdesc="http://facebook.com/midwestwindowbrokers" /><img src="/images/twitter.jpg" width="37" height="51" alt="twitter" longdesc="http://twitter.com/midwestwindow" /><img src="/images/google.jpg" width="42" height="51" alt="google+" longdesc="http://https://plus.google.com/u/0/b/108071947231835835141/108071947231835835141/posts" /></div>
      <!-- end .header --></div>
      <!-- TemplateBeginEditable name="navbar" -->
      <div id="h-navbar">
        <div id="h-navbar2">  Content for  id "h-navbar2" Goes Here</div>
      </div>
      <!-- TemplateEndEditable -->
      <div class="sidebar1">
        <ul class="nav">
        </ul>
        <p> <div id="wufoo-z7x3k1">
    Fill out my <a href="http://midwestwindow.wufoo.com/forms/z7x3k1">online form</a>.
    </div>
    <script type="text/javascript">var z7x3k1;(function(d, t) {
    var s = d.createElement(t), options = {
    'userName':'midwestwindow',
    'formHash':'z7x3k1',
    'autoResize':true,
    'height':'601',
    'async':true,
    'header':'show'};
    s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'wufoo.com/scripts/embed/form.js';
    s.onload = s.onreadystatechange = function() {
    var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
    try { z7x3k1 = new WufooForm();z7x3k1.initialize(options);z7x3k1.display(); } catch (e) {}};
    var scr = d.getElementsByTagName(t)[0], par = scr.parentNode; par.insertBefore(s, scr);
    })(document, 'script');</script></p>
        <!-- end .sidebar1 --></div>
      <!-- TemplateBeginEditable name="Body" -->
      <div class="content">
        <h1>Instructions</h1>
        <p>Be aware that the CSS for these layouts is heavily commented. If you do most of your work in Design view, have a peek at the code to get tips on working with the CSS for the fixed layouts. You can remove these comments before you launch your site. To learn more about the techniques used in these CSS Layouts, read this article at Adobe's Developer Center - <a href="http://www.adobe.com/go/adc_css_layouts">http://www.adobe.com/go/adc_css_layouts</a>.</p>
        <h2>Clearing Method</h2>
        <p>Because all the columns are floated, this layout uses a clear:both declaration in the .footer rule.  This clearing technique forces the .container to understand where the columns end in order to show any borders or background colors you place on the .container. If your design requires you to remove the .footer from the .container, you'll need to use a different clearing method. The most reliable will be to add a &lt;br class=&quot;clearfloat&quot; /&gt; or &lt;div  class=&quot;clearfloat&quot;&gt;&lt;/div&gt; after your final floated column (but before the .container closes). This will have the same clearing effect.</p>
        <h3>Logo Replacement</h3>
        <p>An image placeholder was used in this layout in the .header where you'll likely want to place  a logo. It is recommended that you remove the placeholder and replace it with your own linked logo. </p>
        <p><span style="font-size: 18px; color: #C00; font-weight: bold; font-style: italic;">Logo Replacement</span></p>
        <p> Be aware that if you use the Property inspector to navigate to your logo image using the SRC field (instead of removing and replacing the placeholder), you should remove the inline background and display properties. These inline styles are only used to make the logo placeholder show up in browsers for demonstration purposes. </p>
        <p>To remove the inline styles, make sure your CSS Styles panel is set to Current. Select the image, and in the Properties pane of the CSS Styles panel, right click and delete the display and background properties. (Of course, you can always go directly into the code and delete the inline styles from the image or placeholder there.)</p>
        <h4>Backgrounds</h4>
        <p>By nature, the background color on any div will only show for the length of the content. This means if you're using a background color or border to create the look of a side column, it won't extend all the way to the footer but will stop when the content ends. If the .content div will always contain more content, you can place a border on the .content div to divide it from the column.</p>
        <!-- end .content -->
      </div>
      <!-- TemplateEndEditable -->
      <div class="footer">
        <p class="footer"><strong>  <em>References Available!</em>     We accept cash, check, Visa, Discover, MasterCard</strong></p>
          Copyright 2012 Midwest Window Brokers Inc. All Rights Reserved.
        <!-- end .footer --></div>
      <!-- end .container --></div>
    </body>
    </html>

    I had saved one copy as an .asp but then resaved it to .xhtml 
    I'm assuming this is a static web site.  Rename (F2) all your pages with .html or .htm extension. 
    .xhtml is not a valid extension.
    Nancy O.

Maybe you are looking for

  • Could anyone help me with my program

    Hi i have a piece of code which i want to improve. The two methods are SplitTextArea and SplitGlossArea. SplitTextArea, looks at the black and white parts of the page and uses this to separate sentances from eachother by detecting where the sentance

  • Freezes when I hit record (audio)

    When I have audio already on a track and hit record midway, it freezes. Strangely, I can start a new empty track and record audio from there, but if I try to cut in on a track midway with audio on it, it freezes. Using Logic 10.1.0, Mac OS 10.9.4 6 G

  • Is it possible to change the transfer mode at runtime?

    I was building a WCF service using BasicHttpBinding which typically transmits small messages, but I can not know in advance what will be the maximum size of transmitted files. For these reasons, currently I set Streamed as transfer mode, using Stream

  • Printing single page from book

    I would like to print a single page from an Aperture book containing 25 pages. I tried on my Epson 2400, but all 25 pages went to the printer. Thanks, Susan

  • System Center 2012System Center 2012 Licensing

    hi SCCM expert Can some one explain how SCCM  licensing work simple way? I want to use SCCM2012 to manage physical and virtual server infrastructure  as well and desktop computers At this stage 4xphysicals serves                    2xHypver V host wi