with clause


Posted on 16th Feb 2014 07:03 pm by admin

hi all, i have a big query that usually access the same table more than once. for example, i have something like this

select
from table1 where id = 124
union all
select
from table2 a, (select * from table1 where id 123) b
where a.id=b.id
union all
select
from table3 a, (select * from table1 where id = 345) b
and a.id=b.id

as you can see table1 is part of every union. the problem is that table1 is a huge table retrieving about 11 million records. accessing this table multiple time is hurting performance. i tried using With clause when i look a the explain plan the number of bytes is about 15 g

my question is how can i re-write the above query without accessing the table1 multiple times like i am in the code above.
if i use the with clause, the explain plan show big chuck of memory been use. thanks

No comments posted yet

Your Answer:

Login to answer
306 Like 47 Dislike
Previous forums Next forums
Other forums

Storing Values taken from a DB...
Using this code it will generate a short list from my database

<?php
mysql_connect

simplexml_load_file and rss problem
Hi,

I have a problem parsing an rss feed using simplexml_load_file - this is strange as i hav

Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.

when I go

Stopping page post back
I have few literal contriols in my page and a repeater too. But inspite of using update panel, postb

Showing selected item at top of list
Hi,

I've got a list of names which i am fetching from database like this:
$qry = db_query

recrawling
Can anyone suggest me how may i know a page is updated before it is being downloaded, so that i can

Lining up columns nicely.
Hello everyone, I'm having problems with making columns line up properly. Here is my code:

Please Help my PHP Dating Function.
Hi everyone!

Well here is my code that displays this:

It works wonderful.


extending tidy
I have problem with type-hinting and extending tidy. This code creates error:
Code: class cMyTidy

Kill a process
I have a question - how can I kill a process from a command line or by using Oracle SQL Developer? I

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash