How can i improve a performence of query

How can i improve performence of query which not having the where clause for a table

whenever the query have the where clause then only it can use the indexes
otherwise how it can use the index eventhough we create the index of that table columns.

Similar Messages

  • Utl_raw.bit_and - how can I improve performance of this query?

    Hi all
    Hugely grateful for any light anyone can shed.
    I need to do bit AND operations on 128 bit numbers and I'm stuck in Oracle 10g.
    10g provides a very nice bitand() function that can be applied to numbers but it only works up to 64 bit numbers (actually only 62 I think because it needs a couple of bits)
    So I've been looking at using the utl_raw.bit_and function. It works very well, except that I'm encountering a massive performance hit, which hopefully is in the way I'm using it, rather than intrinsic to the speed at which utl_raw.bit_and itself performs..
    With numbers, I do a query like this:
    select count(1) from offer_a where bitand(bit_column, 51432) = 51432
    With utl_raw.bit_and (and 16-byte RAW column), I am passing in a hex value (may not be the best thing? Would passing in binary be better?) and doing my query like this:
    select count(1) from offer_a where utl_raw.bit_and(bit_column,hextoraw('00000000000000000020008000002ca1')) = hextoraw('00000000000000000020008000002ca1');
    One million rows using bitand takes about a second, using utl_raw.bit_and like this takes 25 seconds or so!!! Hopefully it's something in the way I'm calling it, and there's a faster way?
    Thank you!
    Jake

    Hmm.. Actually it may not be that simple.
    I had created an index on the number column that oracle seems to consistently use if I do a query like:
    select count(1) from scott.offer_b where
    current_price >= 0 and
    bitand(current_price, 9008574719100165) = 9008574719100165
    (without the >= oracle seems to do a full table scan. The reason I created the index is that there's other columns in the data table, making larger blocks. I figured that an index, even though most of needs to be scanned, would be faster because I can cram many more rows into each block..?).
    But if I drop the index on the number column, it takes about 12 secs/1m rows, in other words about half the time of the utl_raw.bit_and().
    So it's possible that bitand on 64 bits takes about half the time of utl_raw.bit_and on 128 bits, which is very reasonable..
    So maybe the real problem I have is why oracle is not using the equivalent index that I placed on the RAW column when I do:
    select count(1) from scott.offer_b where
    hex_bit_sig >= '00000000000000000020008000002ca1' and
    utl_raw.bit_and(hex_bit_sig,'00000000000000000020008000002ca1') = '00000000000000000020008000002ca1';
    (By the way I realized that I don't need to use the hextoraw - seems like just putting a hex number in '' is the right way to specify a raw anyway?)
    So yes, I think that's the real problem - how can I get oracle to use the index I created on the RAW value

  • How can i improve a heavy weight query

    i previously posted a question about a query someone else has written and i am now looking to rewrite to improve its timing.
    this is the old query :
    SELECT 0, 0, 0, 0, SUM(CAST(allowedHours AS number(20,0))) FROM tablex WHERE (forecastCode = 83 AND filesetId in (SELECT VAL FROM tabley WHERE QUERYID = '38ab814a7c465cf8_3afa60db_1134ddf8f6e_-7ff9' AND DATATYPE = 1) AND taskCode in (SELECT VAL FROM tabley WHERE QUERYID = '38ab814a7c465cf8_3afa60db_1134ddf8f6e_-7ff9' AND DATATYPE = 2) AND roleId in (SELECT VAL FROM tabley WHERE QUERYID = '38ab814a7c465cf8_3afa60db_1134ddf8f6e_-7ff9' AND DATATYPE = 3) AND ((weekstart BETWEEN 39171 AND 39534)))
    which i have rewritten so far as :
    SELECT 0, 0, 0, 0, SUM(CAST(TB1.ALLOWEDHOURS AS number(20,0))) "BEST RESULT" FROM TABLEOWNER.TABLEX TB1 WHERE TB1.FORECASTCODE = 83 AND EXISTS (SELECT TBQ.VAL FROM TABLEOWNER.TABLEY TBQ WHERE TBQ.QUERYID = 'v4eaeac2_-17d28fb6_1134e59b62b_-3xx9' AND TBQ.DATATYPE = 2 AND TBQ.VAL= TB1.TASKCODE) AND EXISTS ( SELECT TBQX.VAL FROM TABLEOWNER.TABLEY TBQX WHERE TBQX.QUERYID = 'v4eaeac2_-17d28fb6_1134e59b62b_-3xx9' AND TBQX.DATATYPE = 1 AND TBQX.VAL = TB1.FILESETID ) AND EXISTS (SELECT TBQY.VAL FROM TABLEOWNER.TABLEY TBQY WHERE TBQY.QUERYID = 'v4eaeac2_-17d28fb6_1134e59b62b_-3xx9' AND TBQY.DATATYPE = 3 AND TBQY.VAL = TB1.ROLEID) AND (TB1.WEEKSTART BETWEEN '39171' AND '39534') ;
    this has given me a 70% reduction in the elapsed time of the query.
    for the record :
    TABLEX has 31,536,939 records, of which 15,001,043 are affected by the query.
    and
    TABLEY has 7,539 records.
    in addition i created an index for the large table.
    CREATE INDEX "TABLEOWNER"."TABLEX_IDX" ON "TABLEOWNER"."TABLEX" (FORECASTCODE, TASKCODE, FILESETID, ROLEID, WEEKSTART, ALLOWEDHOURS) TABLESPACE "BIGTABLES" PCTFREE 0 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 2048M NEXT 1024M BUFFER_POOL DEFAULT) LOGGING
    the net result in the explain plan is :
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=13879 Card=1 Bytes=162)
    1 0 SORT (AGGREGATE)
    2 1 HASH JOIN (RIGHT SEMI) (Cost=13879 Card=348592 Bytes=56471904)
    3 2 TABLE ACCESS (FULL) OF 'TABLEY' (TABLE) (Cost=21 Card=503 Bytes=23641)
    4 2 HASH JOIN (RIGHT SEMI) (Cost=13851 Card=352423 Bytes=40528645)
    5 4 TABLE ACCESS (FULL) OF 'TABLEY' (TABLE) (Cost=21 Card=503 Bytes=23641)
    6 4 HASH JOIN (Cost=13807 Card=1276364 Bytes=86792752)
    7 6 SORT (UNIQUE) (Cost=21 Card=503 Bytes=23641)
    8 7 TABLE ACCESS (FULL) OF 'TABLEY' (TABLE) (Cost=21 Card=503 Bytes=23641)
    9 6 INDEX (FAST FULL SCAN) OF 'TABLEX' (INDEX) (Cost=13523 Card=15182009 Bytes=318822189)
    Statistics
    64 recursive calls
    0 db block gets
    58781 consistent gets
    1713 physical reads
    0 redo size
    643 bytes sent via SQL*Net to client
    504 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    1 rows processed
    MY QUESTION. is there anything else i can do to optimize this query. before you say, add an index for TABLEY, don't because this was not as fast as the full table scan, using an index only gave 22% improvement.
    finally, i also analyzed the tables before hand.
    many thanks in advance

    Please post the explain plan and tkprof as described [url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]here. Also please make sure you use the tags [pre] and [/pre]!.
    Regards,
    Rob.

  • How can i imrove peroformance of complex Query

    How can i improve performance of complex Query
    which used CASE WHEN , GROUP By Rollup
    for example
    SELECT CASE WHEN null then a
    ELSE b END
    FROM (
    SELECT a,b,c,..........
    FROM table1
    UNION ALL
    SELECT a,b,c,..........
    FROM table2
    GROUP BY ROLLUP a,b,c ,............
    this query take 18 min to return 180000 record
    is there is any way to improve the performance of this query

    Hello
    Have you considered using
    ALTER SYSTEM SET _fast=TRUE;-)
    Alternatively you could provide some more information such as an execution plan for your query:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    SQL> set linesize 200
    SQL> set pages 50000
    SQL> EXPLAIN PLAN FOR
      2  select * from dual;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |       |       |       |
    |   1 |  TABLE ACCESS FULL   | DUAL        |       |       |       |
    Note: rule based optimization
    9 rows selected.If you want general info on tuning, I suggest you read the Perfomance tuning guide and the Data Warehousing guide. These are the best place to find information about concepts and techniques. The forums are better suited to specific questions.
    HTH
    David

  • How can i improve this query.

    Hi guys i am beginner , just wanted to know some info , how can i improve this query ..
    select *
    from tableA A, viewB B,
    where A.key = B.key
    and a.criteria1 = '111'
    and a.criteria2 = some_funtion(a.key)
    one more thing should function should be on left side of equal sign.
    will a join make it better or something else is needed more than that .

    952936 wrote:
    Hi guys i am beginner , just wanted to know some info , how can i improve this query ..
    select *
    from tableA A, viewB B,
    where A.key = B.key
    and a.criteria1 = '111'
    and a.criteria2 = some_funtion(a.key)
    one more thing should function should be on left side of equal sign.
    will a join make it better or something else is needed more than that .If you are a beginner try to learn the ANSI Syntax. This will help you a lot to write better queries.
    Your select would look like this in ANSI.
    select *
    from tableA A
    JOIN viewB B ON A.key = B.key
    WHERE a.criteria1 = '111'
    and a.criteria2 = some_function(a.key);The good thing here is that this separates the typical joining part of the select from the typical filter criteria.
    The other syntax very often let you forget one join. Just because there are so many tables and so many filters, that you just don't notice correctly anymore what was join and what not.
    If you notice that the number of column is not what you expect, you can easiely modify the query and compare the results.
    example A
    Remove View B from the query (temporarily comment it out).
    select *
    from tableA A
    --JOIN viewB B ON A.key = B.key
    WHERE a.criteria1 = '111'
    and a.criteria2 = some_funtion(a.key)
    example B
    You notice, that values from A are missing. Maybe because there is no matching key in ViewB? Then change the join to an outer join.
    select *
    from tableA A
    LEFT OUTER JOIN viewB B ON A.key = B.key
    WHERE a.criteria1 = '111'
    and a.criteria2 = some_funtion(a.key)(The outer keyword is optional, left join would be enough).

  • How Can we improve the report performance..?

    Hi exports,
    I am learning the Business Objects XIR2, Please let me know How Can we improve the report performance..?
    Please give the answer in detailed way.

    First find out why your report is performing slowly. Then fix it.
    That sounds silly, but there's really no single-path process for improving report performance. You might find issues with the report. With the network. With the universe. With the database. With the database design. With the query definition. With report variables. With the ETL. Once you figure out where the problem is, then you start fixing it. Fixing one problem may very well reveal another. I spent two years working on a project where we touched every single aspect of reporting (from data collection through ETL and all the way to report delivery) at some point or another.
    I feel like your question is a bit broad (meaning too generic) to address as you have phrased it. Even some of the suggestions already given...
    Array fetch size - this determines the number of rows fetched at a single pass. You really don't need to modify this unless your network is giving issues. I have seen folks suggest setting this to one (which results in a lot of network requests) or 500 (which results in fewer requests but they're much MUCH larger). Does either improve performance? They might, or they might make it worse. Without understanding how your network traffic is managed it's hard to say.
    Shortcut joins? Sure, they can help, as long as they are appropriate. [Many times they are not.|http://www.dagira.com/2010/05/27/everything-about-shortcut-joins/]
    And I could go on and on. The bottom line is that performance tuning doesn't typically fall into a "cookie cutter" approach. It would be better to have a specific question.

  • How can I Improve the Performance using Global Temo Tables ??

    Hi,
    Can anyone tell me , How can i make use of Global Temporary Tables to improve the Performance.
    I have few sample scripts ,
    Say i have the View based on some Complex query like ,
    CREATE OR REPLACE VIEW Profile_values_view AS
    SELECT d.Profile_option_name, d.Profile_option_id, Profile_option_value,
    u.User_name, Level_id, Level_code
    FROM Profile_definitions d, Profile_values v, Profile_users u
    WHERE d.Profile_option_id = v.Profile_option_id
    AND ((Level_code = 'USER' AND Level_id = U.User_id) OR
    (Level_code = 'DEPARTMENT' AND Level_id = U.Department_id) OR
    (Level_code = 'SITE'))
    AND NOT EXISTS (SELECT 1 FROM PROFILE_VALUES P
    WHERE P.PROFILE_OPTION_ID = V.PROFILE_OPTION_ID
    AND ((Level_code = 'USER' AND
    level_id = u.User_id) OR
    (Level_code = 'DEPARTMENT' AND
    level_id = u.Department_id) OR
    (Level_code = 'SITE'))
    AND INSTR('USERDEPARTMENTSITE', v.Level_code) >
    INSTR('USERDEPARTMENTSITE', p.Level_code));
    Now i have created the Global temp Table as ,
    CREATE GLOBAL TEMPORARY TABLE Profile_values_temp
    Profile_option_name VARCHAR(60) NOT NULL,
    Profile_option_id NUMBER(4) NOT NULL,
    Profile_option_value VARCHAR2(20) NOT NULL,
    Level_code VARCHAR2(10) ,
    Level_id NUMBER(4) ,
    CONSTRAINT Profile_values_temp_pk
    PRIMARY KEY (Profile_option_id)
    ) ON COMMIT PRESERVE ROWS ORGANIZATION INDEX;
    Now I am Inserting the Records into Temp table as
    INSERT INTO Profile_values_temp
    (Profile_option_name, Profile_option_id, Profile_option_value,
    Level_code, Level_id)
    SELECT Profile_option_name, Profile_option_id, Profile_option_value,
    Level_code, Level_id
    FROM Profile_values_view;
    COMMIT;
    Now what my doubt is, when do i need to execute the Insert Statement.
    Say , if the View returns few millions of records , then loading such a data into Global Temporary table takes lot of time.
    Then what is the use of Global Temporary tables and how can i improve the Performance using the same.
    Raj

    Thanks for the responce ,
    There are 2 to 3 complex views in our database, and there always be more than 5000+ users will be workinf on the application and is OLTP application. Those complex views are killing the application performance.
    I what i felt was, if i create the Global Temporary tables for thow views and will be able to load the one third million of records returned by the views in to cache and can improve the application performance.
    I have created the Global Temporary tables for 2 views with the option On Commit Preserve , But after am inserting the records into the Temp table and when i Issue the commit statement, the Temp table is getting Cleared.
    I really got surpised of this behaviour as i know that with the Option On Commit Preserve , the rows should retain in the Temp Table, Instead , it's getting cleared.
    Pelase suggest , what to do ??
    Raj

  • How can I improve the stability of itunes64bit 8.0.2 on my Vista system?

    Vista Home Premium: iTunes64bit: application crashes after adding album photos and then changing views (list, Album, split) or clicking on different playlists and back to the entire music library.
    The library has 42,000 items (mostly music) so it is quite large. At launch it takes a long time for itunes to load and display. There is no user cues telling me it is running. It simply displays after 60 or more seconds.
    Then I start working in the library, pasting pictures to multiple items, modifying album titles.
    After doing a few management tasks on my music items and navigating back and forth between the music library and playlist (changing views), the application stop being responsive and according to the log, the app just plainly crashes.
    Sometimes I can restart successfully but most of the times, I need to stop the itunes service or log-out before I can restart it successfully.
    I am using itunes64bit 8.0.2
    I am running it on a machine equipped with 4GB of ram and the library lives on a 500GB external hard drive plugged-in through USB 2.0.
    How can I improve the stability of itunes64bit on my system?
    Message was edited by: JF Boisvert

    This VI can be convert to labview 8.0 because subvi are not compatible with old version.
    I post a screenshot.
    Aurélien J.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Du 30 juin au 25 août, embarquez pour 2 mois de vidéo-t'chat ! Prenez place pour un voyage au coe...
    Attachments:
    image.jpg ‏38 KB

  • How can I improve quality of image when burning a movie to a DVD

    How can I improve quality of image when burning a movie to a DVD?

    What resolution are you using?  If the DVD is to be playable on an ordinary DVD player, only ordinary TV resolution is supported.  You need Blue ray for HD.
    Geoff.

  • How can I flip my iphone videos on my PC? My videos from my iphone are horrible when I transfer them to my PC. How can I improve the video on my PC? Can I just convert the files to WMV? When the video plays the speed is off, it's half slow-motion

    My videos from my iphone are horrible when I transfer them to my PC. How can I improve the video on my PC? Can I just convert the files to WMV? When the video plays the speed is off, it's half slow-motion and staggers into normal play. The clips are slightly cut as well, the clips do not roll continuously.  I'm taling about videos that are no more than 2 minutes long.  I'm frustrated and I could really use some advice-my kids basketball games is what I'm recording and I'm trying to send them to my family (they are not very tech savvy). Thanks

    Not it's only function but one for which it was most admirably suited, which is why I really hope someone can find a work around. I am hoping my post to the Apple feedback may prompt a useful response from Apple and I live in hope that my post here will elicit a useful response from another user. I did not miss the the text at the top of the feedback form but you presumably missed my initial text, 'someone here can explain' or my subsequent 'work around from another user'
    Just in case anyone reading this has a large collection of music videos, video podcasts or iTunes U then DO NOT upgrade your iPad to iOS 5. If you are considering purchasing the iPad as a useful mobile device to experience these media organised in your iTunes please don't as you will be wasting your money. (unless someone on this forum knows of a way to undo the mess created by those infallible folks at Apple)
    Yes I know it does other things but the purpose I bought it for doesn't work anymore

  • How can I improve download speed

    How can I improve download speed of movies purchased from iTunes on my AppleTV? 10 hours+ minimum. I've already selected a lower video resolution from the settings in the iTunes store.   It used to be way faster. Any suggestions?  Thanks.

    Check the Internet speed to confirm it is what it is supposed to be by going to www.speedtest.net
    On the ATV, try Settings > General > Reset.
    Power cycle the router, modem, and the ATV

  • How can i improve jsf application? It eat a lot of  CPU.

    I use only request beans, state save method is server.
    How can I improve it, what is with state manager, save state tree.?

    Profile your application and find the CPU hotspots. Then you can figure out what needs improvement.

  • How can I improve speed on iMovie?

    How can I improve speed on iMovie?

    Hello jaquade,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iMovie: Tips to improve performance
    http://support.apple.com/kb/TA27648?viewlocale=en_US
    Best of luck,
    Mario

  • How can I create variant of control query?

    Dear Expert,
    I am using BEx Broadcaster to bradcast query as a report.
    In tab Filter Navigation, I enter the control query, but the variant always gives me "(No Selection Possible)".
    How can I create variant of control query?
    I try to create variant via variable entry page when I excute my query.
    The variable show in table "RSRPARAMETRIZA" but not show in BEx Braodcaster.
    Thank you,
    Zilla

    Hello,
    Please run this control query on the portal and then save variant you require. If you want this variant to be available
    to all users make sure that the user specific flag is unchecked while saving the variant.
    Regards,
    Michael

  • HT1651 how can i improve my macbook's performance without installing memory

    how can i improve my macbook's performance without installing memory

    More RAM & bigger faster Hard Drive will help, maybe a better Graphics card also, since 10.5 ises the Video much harder.
    At the Apple Icon at top left>About this Mac.
    Then click on More Info>Hardware and report this upto *but not including the Serial#*...
    Hardware Overview:
    Machine Name: Power Mac G5 Quad
    Machine Model: PowerMac11,2
    CPU Type: PowerPC G5 (1.1)
    Number Of CPUs: 4
    CPU Speed: 2.5 GHz
    L2 Cache (per CPU): 1 MB
    Memory: 10 GB
    Bus Speed: 1.25 GHz
    Boot ROM Version: 5.2.7f1
    Then click on More Info>Hardware>Graphics/Displays and report like this...
    NVIDIA GeForce 7800GT:
      Chipset Model:          GeForce 7800GT
      Type:          Display
      Bus:          PCI
      Slot:          SLOT-1
      VRAM (Total):          256 MB
      Vendor:          nVIDIA (0x10de)
      Device ID:          0x0092
      Revision ID:          0x00a1
      ROM Revision:          2152.2
      Displays:
    VGA Display:
      Resolution:          1920 x 1080 @ 60 Hz
      Depth:          32-bit Color
      Core Image:          Supported
      Main Display:          Yes
      Mirror:          Off
      Online:          Yes
      Quartz Extreme:          Supported
    Display:
      Status:          No display connected

Maybe you are looking for