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

What's best way to get a user's Word doc converted to simple html and images?
Hi all,

I was just wondering if anybody has any experience of this.
Basically, I'm buildin

phpmailer class & pop.gmail.com?
Code: <?php
$mail->IsSMTP();
$mail->Host = "pop.gmail.com";

Deleting pointers froms vector?
Hi. I have a vector filled with pointers and I want to delete the pointers. I could do a loop and do

Pls help with PHP
Pls can anyone direct me on how to create a user account for a customer. For example i want know if

Check Date/Time in PHP
What I need the code to check is that $reQuest is 24 hours in the past then return a time based on h

Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag

Login page problems
I developed a website a few months ago and I am now having an issue with logging into it. The place

php problem?
I don't think I'm stupid, but maybe I am.

I am working on a sit for a friend I am try to put

Help a newbee save my job !
Hey guys i am dying here i am new to php and would like for someone to help me with this problem

Find only certain URLs from page ... regex (semi-complete script)
Hi guys,

What I need to do is take a page & extract all the URLs from the page &a

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