What is the best way to replace the Inline Views for better performance ?

Hi,
I am using Oracle 9i ,
What is the best way to replace the Inline Views for better performance. I see there are lot of performance lacking with Inline views in my queries.
Please suggest.
Raj

WITH plus /*+ MATERIALIZE */ hint can do good to you.
see below the test case.
SQL> create table hx_my_tbl as select level id, 'karthick' name from dual connect by level <= 5
2 /
Table created.
SQL> insert into hx_my_tbl select level id, 'vimal' name from dual connect by level <= 5
2 /
5 rows created.
SQL> create index hx_my_tbl_idx on hx_my_tbl(id)
2 /
Index created.
SQL> commit;
Commit complete.
SQL> exec dbms_stats.gather_table_stats(user,'hx_my_tbl',cascade=>true)
PL/SQL procedure successfully completed.
Now this a normal inline view
SQL> select a.id, b.id, a.name, b.name
2 from (select id, name from hx_my_tbl where id = 1) a,
3 (select id, name from hx_my_tbl where id = 1) b
4 where a.id = b.id
5 and a.name <> b.name
6 /
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=7 Card=2 Bytes=48)
1 0 HASH JOIN (Cost=7 Card=2 Bytes=48)
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'HX_MY_TBL' (TABLE) (Cost=3 Card=2 Bytes=24)
3 2 INDEX (RANGE SCAN) OF 'HX_MY_TBL_IDX' (INDEX) (Cost=1 Card=2)
4 1 TABLE ACCESS (BY INDEX ROWID) OF 'HX_MY_TBL' (TABLE) (Cost=3 Card=2 Bytes=24)
5 4 INDEX (RANGE SCAN) OF 'HX_MY_TBL_IDX' (INDEX) (Cost=1 Card=2)
Now i use the with with the materialize hint
SQL> with my_view as (select /*+ MATERIALIZE */ id, name from hx_my_tbl where id = 1)
2 select a.id, b.id, a.name, b.name
3 from my_view a,
4 my_view b
5 where a.id = b.id
6 and a.name <> b.name
7 /
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=8 Card=1 Bytes=46)
1 0 TEMP TABLE TRANSFORMATION
2 1 LOAD AS SELECT
3 2 TABLE ACCESS (BY INDEX ROWID) OF 'HX_MY_TBL' (TABLE) (Cost=3 Card=2 Bytes=24)
4 3 INDEX (RANGE SCAN) OF 'HX_MY_TBL_IDX' (INDEX) (Cost=1 Card=2)
5 1 HASH JOIN (Cost=5 Card=1 Bytes=46)
6 5 VIEW (Cost=2 Card=2 Bytes=46)
7 6 TABLE ACCESS (FULL) OF 'SYS_TEMP_0FD9D6967_3C610F9' (TABLE (TEMP)) (Cost=2 Card=2 Bytes=24)
8 5 VIEW (Cost=2 Card=2 Bytes=46)
9 8 TABLE ACCESS (FULL) OF 'SYS_TEMP_0FD9D6967_3C610F9' (TABLE (TEMP)) (Cost=2 Card=2 Bytes=24)
here you can see the table is accessed only once then only the result set generated by the WITH is accessed.
Thanks,
Karthick.

Similar Messages

  • The best way to replace the internal hard drive

    Hi,
    I have a MacBook with a 160gb hard drive which has been partitioned into two partitions one for OSX (130gb) and the other for Windows 7(30gb) and as you can imagine 30gigs for windows is almost nothing, the OS itself is taking a big percentage of its capacity, so I would like to expand both partitions by having a bigger hard drive installed but I was wondering what would bethe best way to do this so I don’t have to reinstall OSX and Windows 7, I have heard about Super Duper for OSX I don’t know if a similar software exists for Windows, well I don't even know if this is the way to go. So my question would is...
    What would be the best way to replace an internal hard drive and have everything moved including the Operating Systems (OSX Lion and Windows7)?
    Can someone be so kind and tell me the procedure I should follow to accomplish this task? I’m not expecting a step by step tutorial but if you could list the tools needed and a brief procedure it would be greatly appreciated.
    Oh, I’m using Boot Camp for the Windows 7 installation.
    Thanks a lot.

    For a hard drive try Newegg.com http://www.newegg.com/Store/SubCategory.aspx?SubCategory=380&name=Laptop-Hard-Dr ives&Order=PRICE
    Or OWC  http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
    Here's instructions on replacingthe hard drive http://creativemac.digitalmedianet.com/articles/viewarticle.jsp?id=45088
    To transfer your current hard drive I like the free application Carbon Copy Cloner. It makes a bootable copy of everything on your hard drive http://www.bombich.com/index.html You'll need a cheap SATA external hard drive case. Put the new drive in the case then partition and format the new drive and clone your old drive to the new one. Check that it's set up right by booting up from the external drive. Then replace your old hard drive with the new one.
    Here's a cheap SATA external hard drive case on eBay http://cgi.ebay.com/USB-2-5-SATA-HDD-HARD-DRIVE-EXTERNAL-ENCLOSURE-CASE-BOX-/120 636286623?pt=PCC_Drives_Storage_Internal&hash=item1c167ba69f
    For copying the Windows partition I like WinClone http://download.cnet.com/Winclone/3000-2242_4-172338.html
    After you've installed your Mac OS with Carbon Copy Cloner (or SuperDuper) on the new drive create a new Windows partition with Boot Camp and copy your WinClone copy to it with Winclone.

  • What is the best way to replace a cracked screen for the MacBook Pro?

    My MacBook Pro was accidentally droped and the screen was cracked.  Need to find out what is the most effecient way to replace the screen?

    Contact your nearest Authorized Apple Service Provider and ask them about the costs.
    MacBook Pro - Contact Support - Apple Support

  • What's the best way to replace front glass on an iPhone 4?

    My grandson has a 4 and has cracked the front glass. Trying to find the best cost effective way to replace the glass.

    i don\'t want an alias!! wrote:
    What's the best way to replace front glass on an iPhone 4?
    Take it to an Apple Store for out of warranty exchange fro $149.
    This way you get a refurb iPhone including new battery.
    See this -> http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
    Out-of-Warranty Service
    If you own an iPhone that is ineligible for warranty service but is eligible for Out-of-Warranty (OOW) Service, Apple will service your iPhone for the Out-of-Warranty Service fee listed below.
    iPhone model
    Out-of-Warranty Service
    iPhone 5s, iPhone 5c,
    iPhone 5
    $269
    iPhone 4S
    $199
    iPhone 4, iPhone 3GS,
    iPhone 3G, Original iPhone
    $149

  • What's the best way to replace a 60 W Mag Safe Power Adapter?

    What's the best way to replace a 60 W Mag Safe Power Adapter for a Macbook Pro?

    Buy one from Apple!!

  • Hi, what's the best way to replace IMAC 27'' glass when broken (latest Imac generation from end 2012) ?  Thanks,

    Hi, what's the best way to replace IMAC 27'' glass when broken (latest Imac generation from end 2012) ?  Thanks,

    Not sure about the 2012 models but the 2010 ones can be removed in seconds, using a suction cup on the top corner. I use my tomtom to lift it away. It is attached by magnets.
    Hope this helps.

  • Mac Pro won't start up.  What's the best way to check the power supply?

    Hello. I'm having a severe problem with my 2007 Mac Pro. The symptoms are very easy to describe. The computer apparently shut itself off overnight, and when I press the power button to turn it on, absolutely nothing happens. No lights, no chime, no signs of any power whatsoever in the computer. I have never had major problems with the computer before. (Although I had recently noticed some minor skipping problems with streaming videos and Firefox had started hanging occasionally.)
    So far, I have checked the power cable and the power outlet. I have also reset the SMC (holding in the Power button for 5 seconds with the unit unplugged). I am unable to see any light in the diagnostic LEDs (including LED 1) when I press the DIAG_LED button on the logic board.
    While I welcome other suggestions, all I can figure is that this is either a power supply problem or a major logic board failure, but I don't know which. I have a multimeter and would like to test very directly if the power supply is the problem, because they are very expensive and obviously I do not want to order a replacement supply if it would not fix the computer. Does anyone know what the best way to test the supply directly is? What pins on what cable should I test, and what voltage should I look for?
    Also: No the computer is not under any warranty. If at all possible, I would like to fix this myself. Thanks for any help you can give.

    Well, I may have found the answer to my question as to why replacing the fuse dows not seem to be encouraged. I cut out the failed fuse (fast fuse, ceramic, 16 Amp 250V), and replaced it with another that was as close to it in spec as I could find (15 A instead of 16). Then I put the supply back in the case.
    When I tried to plug it in, I got an immediate spark, followed by an acrid smell from the power supply. Later inspection revealed that the new fuse blew, as did another component nearby (not sure what it was) where I could see blackening and the smell was concentrated. At this point, I would consider myself lucky if the power supply didn't take anything else on the computer out with it.
    Lesson learned; will try a new power supply and go from there.

  • I have lightroom 5.7. Now I have apple TV to connect my Mac to the TV scree. I wish to do a slide show on the TV. However, on the Mac, using ITunes to share photos with the TV, I cannot locate all photo files. What is the best way to save the slide show a

    I have lightroom 5.7. Now I have apple TV to connect my Mac to the TV scree. I wish to do a slide show on the TV. However, on the Mac, using ITunes to share photos with the TV, I cannot locate all photo files. What is the best way to save the slide show and put it where the Mac sharing can find it? So far, I made on one folder in Lightroom, put some photos there and I found them easily. Can this be done with a slide show? Please help quickly! Also worried that the photos I put on the new folder are hard to find afterwards, when the show is done. Where do they go when I delete from from the new folder?I am not alone

    Not that I'm aware of. You just export JPEG copies to a folder that you can point iTunes to. For instance, I have created a folder in my Pictures folder called Apple TV. And within that folder I have other folders of pictures that I can choose from in iTunes to share with Apple TV. But there doesn't seem to be any way to share a Lightroom slideshow. If you have laid to create a video file that would probably work. Apple TV is a little clunky in my opinion. Some things are a little more difficult to do now than they were a while back. I probably haven't provided you with much help, but just keep experimenting and I think you will figure it out.

  • I am moving from PC to Mac.  My PC has two internal drives and I have a 3Tb external.  What is best way to move the data from the internal drives to Mac and the best way to make the external drive read write without losing data

    I am moving from PC to Mac.  My PC has two internal drives and I have a 3Tb external.  What is best way to move the data from the internal drives to Mac and the best way to make the external drive read write without losing data

    Paragon even has non-destriuctive conversion utility if you do want to change drive.
    Hard to imagine using 3TB that isn't NTFS. Mac uses GPT for default partition type as well as HFS+
    www.paragon-software.com
    Some general Apple Help www.apple.com/support/
    Also,
    Mac OS X Help
    http://www.apple.com/support/macbasics/
    Isolating Issues in Mac OS
    http://support.apple.com/kb/TS1388
    https://www.apple.com/support/osx/
    https://www.apple.com/support/quickassist/
    http://www.apple.com/support/mac101/help/
    http://www.apple.com/support/mac101/tour/
    Get Help with your Product
    http://docs.info.apple.com/article.html?artnum=304725
    Apple Mac App Store
    https://discussions.apple.com/community/mac_app_store/using_mac_apple_store
    How to Buy Mac OS X Mountain Lion/Lion
    http://www.apple.com/osx/how-to-upgrade/
    TimeMachine 101
    https://support.apple.com/kb/HT1427
    http://www.apple.com/support/timemachine
    Mac OS X Community
    https://discussions.apple.com/community/mac_os

  • What is the best way to mimic the data from production to other server?

    Hi,
    here we user streams and advanced replication to send the data for 90% of tables from production to another production database server. if one goes down can use another one. is there any other best option rather using the streams and replication? we are having lot of problems with streams these days they keep break and get calls.
    I heard about data guard but dont know what is use of it? please advice the best way to replicate the data.
    Thanks a lot.....

    RAC, Data Guard. The first one is active-active, that is, you have two or more nodes accessing the same database on shared storage and you get both HA and load balancing. The second is active-passive (unless you're on 11.2 with Active Standby or Snapshot Standby), that is one database is primary and the other is standby, which you normally cannot query or modify, but to which you can quickly switch in case primary fails. There's also Logical Standby - it's based on Streams and generally looks like what you seem to be using now (sort of.) But it definitely has issues. You can also take a look at GoldenGate or SharePlex.

  • I have a iMac Desktop and MacBook Pro laptop. I generate my work related files on both of these machines. What is the best way to keep the files in these machines synchronized?

    I have a iMac Desktop and MacBook Pro laptop. I generate my work related files on both of these machines. After a few days or weeks, I have new files on some folders on either of the machines that is not on the other machine. What is the best way to keep the files in these machines synchronized?

    How did you transfer the files to the iMac.  If you exported the files out of the MB library using Kind = Current you should get the edited version.  Any other  option may not.
    If you want to keep the two libraries "synced"  any photos you want to move to the iMac should be added to an album, connect the two Mac with a LAN, Target Disk Mode,  Transferring files between two computers using FireWire, with WiFi. and use the paid version of  iPhoto Library Manager to copy that album from the MB library to iMac library.  It will also copy the original and edited versions, keywords, titles, etc.
    OT

  • What is the best way to keep the battery built-in last longer?

    what is the best way to keep the battery built-in in macbook pro last longer???..
    is it by plugged in as many times as we can..and discharge it to 80-90% a week..then charged it back?

    My favorite tip for longer battery life: Uninstall Flash

  • Iphone 4s coming friday, what is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across.

    What is the best way to get the notes content from iphone 4 to 4s without doing a restore? i want the new phone to be totally new but not sure how to get notes content across. If I do a restore as I have when previously from one iphone to another it has shown (in settings, usage) the cumulative usage from previous phones so all the hours of calls on all previous iphones will be displayed even though its brand new. Anyone know how I can get my notes (from standard iphone notes app) to my new iphone 4s without restoring from previous iphone 4. Thanks for any help offered.

    First, if you haven't updated to iTunes 10.5, please update now as you will need it for the iPhone 4S and iOS 5.
    Once you're done installing iTunes 10.5, open it. Connect your iPhone to iTunes using the USB cable. Once your iPhone pops up right click on it. For example: an iPhone will appear and it will say "Ryan's iPhone."
    Right click on it and select "Backup" from the dropdown menu. It will start backing up. This should backup your notes.
    Please tell me if you have any problems with backing up.
    Once you backup and get your iPhone 4S, you must follow these steps. If you don't follow these steps, you will not be able to get your notes on your new iPhone 4S.
    Open up iTunes again then right click on your device (iPhone 4S). Once you do you will see a dropdown menu. It will say "Restore from Backup..." Select this and it'll ask for a backup, select it from the dropdown menu. For example "Ryan's iPhone - October 12, 2011." Pick that and it will restore to your backup. Do this when you get your iPhone 4S so you will not lose anything. Even though you're restoring, you're getting back, since you're getting the previous settings, notes, contacts, mail and other settings from your old iPhone. You'll still have Siri though! So, restore when you first get it. Also frequently backup your device, as it will be worth it. You can restore from a backup if something goes wrong or save your data for a future update.
    Once you do that, you should have your notes on your new iPhone 4S and iOS 5.
    Please tell me if you need any help.
    I hoped I answered your questions and solved your problem!

  • What is the best way to export the data out of BW into a flat file on the S

    Hi All,
    We are BW 7.01 (EHP 1, Service Pack Level 7).
    As part of our BW project scope for our current release, we will be developing certain reports in BW, and for certain reports, the existing legacy reporting system based out of MS Access and the old version of Business Objects Release 2 would be used, with the needed data supplied from the BW system.
    What is the best way to export the data out of BW into a flat file on the Server on regular intervals using a process chain?
    Thanks in advance,
    - Shashi

    Hello Shashi,
    some comments:
    1) An "open hub license" is required for all processes that extract data from BW to a non-SAP system (including APD). Please check with your SAP Account Executive for details.
    2) The limitation of 16 key fields is only valid when using open hub for extracting to a DB table. There's no such limitation when writing files.
    3) Open hub is the recommended solution since it's the easiest to implement, no programming is required, and you don't have to worry much about scaling with higher data volumes (APD and CRM BAPI are quite different in all of these aspects).
    For completeness, here's the most recent documentation which also lists other options:
    http://help.sap.com/saphelp_nw73/helpdata/en/0a/0212b4335542a5ae2ecf9a51fbfc96/frameset.htm
    Regards,
    Marc
    SAP Customer Solution Adoption (CSA)

  • Hi I would like to show a presentation written on my macbook air on my television what is the best way to connect the two ?

    Hi I would like to show a presentation written on my macbook air on my television what is the best way to connect the two ?

    Much depends on the available connectivity  of your television.
    If it has HDMI input available, all you will need is a minidisplayport to HDMI adapter, and an HDMI cable long enough to place the Mac in the desired proximity to the TV. The adapter is avaialble from the Apple Store online.
    Provided the HDMI input on the television supports sound, and the model of your MBA supports it as well, make suree that your adapter is also supportive of sound, otherwise you will need to run separate cabling from the headphone jack of the MBA to TV sound input or external speakers.
    This is a somewhat specific answer to a question without any requisite detail. You don't indicate the model or type of inputs on your TV, nor do you indicate the model/generation of MBA you have.

Maybe you are looking for

  • I cannot access AppleWorks 6, is there a way to convert them?

    I just installed Mavericks and since I cannot access AppleWorks 6, is there a way to convert them? I know AppleWorks 6 is old, but I have some documents that I need.  My windows laptop asks what I want to convert files into and I'm hoping there is so

  • VIEW XML IN SQL*PLUS

    how can we view xml on sql*plus? when xmltype is viewed on sql*prompt it shows incomplete xml. example: SQL> select xmlelement("ROOT",xmlforest(1 as A, 2 as B, 3 as C)) from dual; XMLELEMENT("ROOT",XMLFOREST(1ASA,2ASB,3ASC)) <ROOT> <A>1</A> <B>2</B>

  • Smartform Printout overlapping

    Hello All, I have created smartform for MIRO printing with new page format. While printing the print preview is showing proper number of pages but when printout comes, it appears all pages overlapped on single page. In spool number of printing pages

  • T3 on vista - sync

    my T3 will not sync the calendar on win. vista.  everything else works - i've tried everything  - HELP !! sh Post relates to: Tungsten T3

  • Mac Server VPN Requires Restart When Waking from Sleep

    I am running OS 10.9.4 and Server 3.1.2.  I had a L2TP VPN configured and working well.  I suspect the 10.9.4 update caused the following issue. ISSUE: After waking from sleep, the VPN service requires a restart in order to accept connections.  Clien