Querying an indexed database column. How?

Hi there,
I am pretty good at CF and okay at SQL.
Over the years I have been informed that when using the same column in a database multiple times to do look-ups....e.g. a primary key field....that it would be best to "index" this column to improve speed.
However, I'm not fully sure what or how to index a database column. I have a few questions:
Is it something to do in MySQL directly? Or can it be done programmatically with CF?
Does it really speed things up a lot?
How is new data entered affected? Does that new data get included into the index?
Does my cfquery syntax have to be any different than is normal?
Any help or advice would be great.
I'm using CF8 and MySQL5 (query browser tools etc)
Thanks,
Mikey.

Indexing is a database topic.  As databases can be controled by SQL commands it would most likely be possible to do so inside of a <cfquery...> block, but I would only do that in rare circumstances.
Indexing a table will almost always speed up frequently used database columns.  But when, how and why one would index a database column is a big topic on which entire papers, books and college classes have been developed around.  I would start with some reading of you database documentation an then branch out onto the internet.  You will find much written and should be able to educate yourself easily.

Similar Messages

  • Query a non-database column

    My main table is SR_TECHS which has tech id and Techname
    My second table and block is sr_tech_calendar.
    Here tech_name is a non-database field.
    When I type J% in the Tech_name field and query, I should be able to get all tech_names
    starting with 'J'
    How can I get it through pre-query and what should I do in the post-query?

    you achieve this by setting
    set_block_property('blockname',default_where,'give neccessery where condition')
    in pre_query trigger
    siby

  • Query on database column not working

    Hi
    i have a block which has around 40 columns.the block is based on a table which has more than 20000 records.When i try 2 make query on a Database column in Enter-Query mode its not working.It fetching all the records instead of the respective records
    THe block property is said to yes
    i have even set the query allowed,only propery of the column to YEs
    Can any one help me out of this??? do i need to set any other property???

    Thanks a lot for james and THomas and to all. The error is that i have missed the bracket for OR in my where condition ...Now im able to query all the columns.
    Thanks very much...
    I have one more doubt .i have a requirement in which when the user goes to the child block and makes a query is it possible to bring the associates parent records..wht code or trigger we need to rite ?
    normally we do for parent block when we query we populate the child. is this can be done?

  • Reducing the Cost of the query by indexing.

    Hello,
    I have a query as under :
    SELECT T1_WO.WO_ID, T1_RW_MSG.RMSG_FN_ID, T1_RW_MSG.RMSG_PROD_CD, T1_RW_MSG.RMSG_OPRN_CD, T1_WO.WO_ENTRY_DT, T1_RW_MSG.RMSG_OUR_REF_NUM, T1_WO.WO_CURR_QUEUE, T1_WO.WO_PRIORITY, T1_WO.WO_STATUS_CD, T1_RW_MSG.RMSG_TRANS_MD, T1_RW_MSG.RMSG_SRC_TYP, T1_WO.WO_TYP_FLG, T1_WO.WO_DEQUEUE_DT, T1_RW_MSG.RMSG_BTCH_ID, T1_RW_MSG.RMSG_SEQ_NUM_IN_BTCH, T1_WO.WO_FRM_QUEUE , T1_WO.WO_ORIG_ENTRY_DT,T1_WO.WO_SRC_TYP, T1_RW_MSG.RMSG_TILIS_PROC_LOC FROM T1_RW_MSG, T1_WO WHERE ( T1_RW_MSG.RMSG_FN_ID = T1_WO.RMSG_FN_ID ) AND ( T1_WO.WO_TYP_FLG = 'R') AND ( ( T1_WO.WO_ERR_FLG = 'F' ) AND ( T1_WO.WO_BSY_FLG = 'F' ) AND (T1_WO.WO_CURR_QUEUE IN ('MUMBAISAP','CCD19SAP') OR (T1_WO.WO_CURR_QUEUE IN ('') AND T1_WO.WO_FRM_ROLE_INSTANCE = 'CCD19SAP') OR (T1_WO.WO_CURR_QUEUE IN ('') AND T1_WO.WO_FRM_ROLE_INSTANCE <> 'CCD19SAP')) )
    ORDER BY T1_WO.WO_PRIORITY DESC, T1_WO.WO_ENTRY_DT ASC;
    This query has an ORDER BY clause wherein two columns
    WO_PRIORITY DESC,WO_ENTRY_DT are used which are not indexed.
    These columns are not indexed.Now I try to reduce the cost of these query by indexing these columns WO_PRIORITY DESC,WO_ENTRY_DT.Will this reduce the cost of the query.
    Message was edited by:
    UdayM

    wrap your code in [code] and [/code] tags to preserve the formatting you will do to make it readable. You're unlikely to get much help if you make it hard to read.
    an example of code formatting:
    WITH t1_wo AS (SELECT 'a' wo_curr_queue from dual
                   UNION
                   SELECT to_char(null) from dual
                   UNION
                   SELECT '' from dual)
      SELECT *
      FROM t1_wo
      WHERE t1_wo.wo_curr_queue IN ('')Interestingly, that returns no rows, which makes me suspect that the sections of your query that include t1_wo.wo_curr_queue IN ('') will never work.

  • How an INDEX of a Table got selected when a SELECT query hits the Database

    Hi All,
    How an Index got selected when a SELECT query hits the Database Table.
    My SELECT query is as ahown below.
        SELECT ebeln ebelp matnr FROM ekpo
                       APPENDING TABLE i_ebeln
                       FOR ALL ENTRIES IN i_mara_01
                       WHERE werks = p_werks      AND
                             matnr = i_mara_01-matnr AND
                             bstyp EQ 'F'         AND
                             loekz IN (' ' , 'S') AND
                             elikz = ' '          AND
                             ebeln IN s_ebeln     AND
                             pstyp IN ('0' , '3') AND
                             knttp = ' '          AND
                             ko_prctr IN r_prctr  AND
                             retpo = ''.
    The fields in the INDEX of the Table EKPO should be in the same sequence as in the WHERE clasuse?
    Regards,
    Viji

    Hi,
    You minimize the size of the result set by using the WHERE and HAVING clauses. To increase the efficiency of these clauses, you should formulate them to fit with the database table indexes.
    Database Indexes
    Indexes speed up data selection from the database. They consist of selected fields of a table, of which a copy is then made in sorted order. If you specify the index fields correctly in a condition in the WHERE or HAVING clause, the system only searches part of the index (index range scan).
    The primary index is always created automatically in the R/3 System. It consists of the primary key fields of the database table. This means that for each combination of fields in the index, there is a maximum of one line in the table. This kind of index is also known as UNIQUE. If you cannot use the primary index to determine the result set because, for example, none of the primary index fields occur in the WHERE or HAVING clause, the system searches through the entire table (full table scan). For this case, you can create secondary indexes, which can restrict the number of table entries searched to form the result set.
    reference : help.sap.com
    thanx.

  • How to create a variance on data that exists iIn only one database column

    How to create a variance on data that exists iIn only one database column?
    I'm trying to create a calculation to show the difference between the budgets for two different years in a Discoverer crosstab query.
    I'm using the lag function to repeat the value of a column for the current year and the year before.

    Lag and lead seems to be the only choice and they work excellent. Checkout the new 10g Database features. There is new SQL modal clause which might give additional and powerful analytics but in this case lag and lead should be sufficient.
    regards
    http://www.infocaptor.com/workbook-dump.php

  • How to write the query using Index

    Hi All,
    I have to fetch the records from Database table using Index, how can i write the query using Index. Can any body plz send me the sample code.
    Help Me,
    Balu.

    Hi,
    See the below Example.
    select * from vbak up to 100 rows
    into table t_vbak
    where vbeln > v_vbeln.
    sort t_vbak by vbeln descending.
    read table t_vbak index 1.
    Regards,
    Ram
    Pls reward points if helpful.

  • ADF How to Download BLOB File from Database Column

    Hi,
    We have one blob Database Column in which we use for storing attachments(eg Image,.doc or.zip) . We are able to upload attachments.
    How can I build page which will access that particular record and will be able to download attachment in it.
    It should prompt to Save and then we can save it on Local machine.
    Thanks,
    Jit

    Sorry, I don't get your question.
    If you have a file name including the suffix like 'Test.file.doc' you can pass this file name as parameter to the method and get the MIME type back. I your sample it would be "application/msword"
    String mime = ContentTypes.get("Test.file.doc");
    public class ContentTypes
        public static String get(String fileName)
            String mime = null;
            String ext = fileName.toLowerCase();
            if (ext.endsWith(".pdf"))
                mime = "application/pdf";
            else if (ext.endsWith(".doc"))
                mime = "application/msword";
            else if (ext.endsWith(".xls"))
                mime = "application/msexcel";
            else if (ext.endsWith(".docx"))
                mime = "application/msword2007";
            else if (ext.endsWith(".xlsx"))
                mime = "application/msexcel2007";
            else if (ext.endsWith(".ppt"))
                mime = "application/vnd.ms-powerpoint";
            else if (ext.endsWith(".rar"))
                mime = "application/octet-stream";
            else if (ext.endsWith(".zip"))
                mime = "application/zip";
            else if (ext.endsWith(".jpg"))
                mime = "image/jpeg";
            else if (ext.endsWith(".jpeg"))
                mime = "image/jpeg";
            else if (ext.endsWith(".gif"))
                mime = "image/gif";
            else if (ext.endsWith(".png"))
                mime = "image/png";
            return mime;
    }Timo

  • How to access a non-database column in a report?

    Hi all,
    I would like to populate a column in my report, which is not based (in Oracle Forms, it is a "non-database item").
    But I don't know how to access it. Let's say the alias of the column is "column", I tried to do it with #column#, but it's not valid.
    Does anyone know a solution here?
    Thanks a lot,
    Dovik

    Dovik
    Where do you need to access the column value ? Are other columns of the report accessible from where you are trying to access the value of this 'non database' column ?
    varad

  • How can I make my query to compare only columns of two tables... not the storage information?

    11GR2
    =-----------------------------------
    I am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and  if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
    begin
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY', TRUE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE', FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'TABLESPACE',FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS',FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',FALSE);
    DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS_AS_ALTER',FALSE);
    End;
    select REGEXP_REPLACE(dbms_metadata_diff.compare_alter('TABLE','TABLE_NAME_A','TABLE_NAME_A','USER1','USER2'),('USER1...'),'', 1, 0, 'i') from dual

    I am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and  if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
    If you want help you have to SHOW us what you are doing and how you are doing it; you can't just try to tell us in your own words.
    We can't see your computer screen.

  • How to query the citadel database

    Is there a way using Lookout to query the citadel data base?
    I have value that is being saved every second say, into the citadel database
    a specific record may look like this for the field   
    MON_DS  = "7:57"  
    Local Time  =  "2/19/06 15:59"
    I want to have the user enter a date and then lookout to query the citadel database and find the
    maximum value for MON_DS for that date.
    Is this possible in lookout?
    I can download the data to a spreadsheet but that is alot of work to load each of the fields & local time records
    frank

    Hi Frank,
    You would use the "c" datamembers (see below), of the right datatype:
    SQLExec Data Members
    Data Member
    Type
    Read
    Write
    Description
    c1 – c65535
    numeric
    yes
    no
    Value of the nth column in the row returned by ODBC.
    c1.logical – c65535.logical
    logical
    yes
    no
    Value of the nth column in the row returned by ODBC.
    c1.txt – c65535.txt
    text
    yes
    no
    Value of the nth column in the row returned by ODBC.
    -Khalid

  • How do I null out an item based on a database column before display?

    I am using Apex 3.2
    I have an item that is based on database column. My customer wants me to "blank out" the item before it is displayed so the user will have to enter a new value in place of the one that is in the database.
    I have tried using a "before region" calculation to set the item to NULL. I can see the value getting set in the debug after the row fetch has occurred, but when the item is displayed, it contains the value from the database, not my calculated valuie.
    I also tried using an unsourced text field and then doing an after submit calculation to set the value of the database column item from there, but no luck that way either.
    Also tried clearing the item cache, but I think that happens way too early.
    There must be a simple way to do this..
    Any suggestion?

    No problem user486652 (name?),
    Yes, the $s function is one of ApEx's built-in's - see the ApEx documentation under API Reference, Javascript API's, and you'll find a wealth of built-in functions that do all sorts of things. For Javascript in general, take a look at www.w3schools.com for some really good tutorial and reference material - I use it constantly.
    Ok, so you want to set the browser field to empty after the page loads. Since this is a page event, it isn't something that will fire for a form field element so you don't want the code there. In ApEx 3.2, edit the attributes for the page, and you'll see a setting called "HTML Body Attribute". You'll see a helpful bullet note below the setting saying this is the place to add onload events. The proper syntax will be:
    onload="$s('P2_REMEDY_TICKET', '');"Once ApEx puts everything together and the page renders, this code will tell the browser to run that $s function after the page loads.
    But be aware - if you take a look at the help for that setting, you'll see that it mentions that this will only work if your page template includes the #ONLOAD# substitution string. Not sure if all ApEx-supplied page templates already have #ONLOAD#, but every one I've used does. If your code still doesn't work, check your page tempate. In the Definition region, under Header, you should see a body tag with something like:
    <body #ONLOAD#>...
    ...If that's there, your page template supports the HTML Body Attribute. If your body tag doesn't have an #ONLOAD#, add it.
    Hope this helps,
    John
    If you find this information useful, please mark the post "helpful" or "correct" so that others may benefit as well.*

  • How to query on non database item?

    I am working on AP Invoice form. The Invoice Header block based on table ap_invoices_all, I have database items such as invoice_num, invoice_date, and invoice_amount. I also have some non databases item like supplier and supplier number. I added POST_QUERY:
    declare
    supplier varchar2(240);
    supplier_number varchar2(30);
    supplier_site varchar2(15);
    begin
    select aps.vendor_name, aps.segment1
    into :invoice_header.supplier, :invoice_header.supplier_number
    from ap_suppliers aps
    where aps.vendor_id = :invoice_header.vendor_id;
    Also in PRE-QUERY
    declare
    supplier varchar2(240);
    supplier_number varchar2(30);
    supplier_site varchar2(15);
    invoice_num varchar2(50);
    invoice_date date;
    invoice_amount number;
    begin
    select aia.invoice_num, aia.invoice_date, aia.invoice_amount
    into :invoice_header.invoice_num, :invoice_header.invoice_date, :invoice_header.invoice_amount
    from ap_invoices_all aia
    where aia.vendor_id = (select vendor_id from ap_suppliers where vendor_name = :invoice_header.supplier);
    It's showing fine with Suppier iformation I query by invoices, but I doesn't work when I query by supplier.
    Can anyone help? I really appreciate.

    Hello,
    Thanks for your reply. I think I need to clarify my problem
    Your cursor has the same result as what I have in the post-query:
    Select aps.vendor_name, aps.segment1
    into :invoice_header.supplier, :invoice_header.supplier_number
    from ap_suppliers aps
    where aps.vendor_id = :invoice_header.vendor_id;
    and they both work when I query on a database item, such as invoice_num and the non database item vendor name and vendor number will show up. I am doing ok with this.
    My problem is when I query on vendor name field which is not a database item, such as CLARK PUBLIC UTILITIES, it will not return CLARK PUBLIC UTILITIES only, instead it returned all the suppliers. Could you please help with this? Thanks a lot.

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

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

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

  • Re: [iPlanet-JATO] Finding the database column length

    This is the technique I would recommend. If you'd like to wrap this
    mechanism up in the model class itself, create a subclass of QueryModelBase
    that provides such a method and use that as the base class for all your
    QueryModels.
    Todd
    ----- Original Message -----
    From: "Craig V. Conover" <craig.conover@S...>
    Sent: Friday, October 19, 2001 12:15 PM
    Subject: Re: [iPlanet-JATO] Finding the database column length
    Chidu,
    The result set that you get back is a JDBC ResultSet, not a "JATO" resultset. In ND, everything was wrapped in a "spider" data
    structure, and therefore, difficult to get to the underlying datastructure, in many cases. In some case ND made it easier to do
    certain things, and in other ways, made it more difficult or impossible(like seeing the SQL for an insert, update, delete).
    >
    Anyway, looking at the java.sql package, you can do this.
    java.sql.ResultSet rs = <jata-model>.getResultSet();
    java.sql.ResultSetMetaData rsMeta = rs.getMetaData();
    // not sure if this is what you need, but it was the closest thing I couldfind
    int colSize = rsMeta.getColumnDisplaySize(int column);
    There are numerous other methods in the ResultSetMetaData interface thatmay be of use as well.
    >
    c
    chidusv@y... wrote:
    Hi,
    How do I find out the length of a database column in a data model? In
    NetDynamics, we can do dataobject.getDataField(<field
    name>).getColumnLength(). Is it possible to achieve this in JATO
    without using a resultset?
    Thanks,
    Chidu.
    For more information about JATO, please visit
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    >>
    >>
    >>
    >>
    >
    >
    >
    For more information about JATO, please visit
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    >
    >
    >
    >
    >
    >
    >

    This is the technique I would recommend. If you'd like to wrap this
    mechanism up in the model class itself, create a subclass of QueryModelBase
    that provides such a method and use that as the base class for all your
    QueryModels.
    Todd
    ----- Original Message -----
    From: "Craig V. Conover" <craig.conover@S...>
    Sent: Friday, October 19, 2001 12:15 PM
    Subject: Re: [iPlanet-JATO] Finding the database column length
    Chidu,
    The result set that you get back is a JDBC ResultSet, not a "JATO" resultset. In ND, everything was wrapped in a "spider" data
    structure, and therefore, difficult to get to the underlying datastructure, in many cases. In some case ND made it easier to do
    certain things, and in other ways, made it more difficult or impossible(like seeing the SQL for an insert, update, delete).
    >
    Anyway, looking at the java.sql package, you can do this.
    java.sql.ResultSet rs = <jata-model>.getResultSet();
    java.sql.ResultSetMetaData rsMeta = rs.getMetaData();
    // not sure if this is what you need, but it was the closest thing I couldfind
    int colSize = rsMeta.getColumnDisplaySize(int column);
    There are numerous other methods in the ResultSetMetaData interface thatmay be of use as well.
    >
    c
    chidusv@y... wrote:
    Hi,
    How do I find out the length of a database column in a data model? In
    NetDynamics, we can do dataobject.getDataField(<field
    name>).getColumnLength(). Is it possible to achieve this in JATO
    without using a resultset?
    Thanks,
    Chidu.
    For more information about JATO, please visit
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    >>
    >>
    >>
    >>
    >
    >
    >
    For more information about JATO, please visit
    http://developer.iplanet.com/tech/appserver/framework/index.jsp
    >
    >
    >
    >
    >
    >
    >

Maybe you are looking for

  • Animated Gif DW8

    I haven't worked with animated gifs in such a long time so I welcome the input from others who are more knowledgeable in this area than I am. I have a client who wants their logo to be animated (and don't want it in Flash). Their design team created

  • With FB02 changes in BSEG-SGTXT  not transferred to COEP-SGTXT

    Hi guys In ECC 6.0 when you change a doc.  with FB02, BSEG-SGTXT is not transferred to COEP-SGTXT. In fact if you parked an invoice with FV60 and leave item text  "SGTXT" field blank , and afterwards you fill the item text with something and save the

  • Export Full Quality Preset in iMovie 09?

    Does iMovie 09 have a way to export movie in full quality? Can DV source be exported as DV?

  • Urgent!! Loginmodule related problem

    Hi, We are implementing NW2004s portal. In our network we have two portals servers(Sharepoint 2007 and SAP Portal). Intranet access: Users will access the SAP Portal by clicking a link in Sharepoint portal server. This needs a Integrated Windows auth

  • ESS Business Package - W4 Input Screen - Non Resident Alient option

    I've been asked to create a specific input screen for NonResident Alient(on W4 screen) of current ESS standard solution, this is an official request that came from IRS(government rule), and SAP provided it in some notes. We have this notes on current