[ followup on a gripe from October ]
Tomasz Myrta <[EMAIL PROTECTED]> writes:
> I want to perform query looking like this:
> select
> user_id,
> a/sum_a as percent_a,
> b/sum_b as percent_b
> from
> users join
> (select
> group_id,
> sum(a) as sum_a,
> sum(b) as sum_b
>f
Stephan Szabo <[EMAIL PROTECTED]> writes:
> Basically, as I understand it,
> select * from a,b where a.a=b.a and a.a=3;
> isn't going to realize that b.a=3 and act as if
> you typed that.
We have talked about adding code to make that deduction. The issue is
how to do so without expending a lot o
Sorry,
In second query is:
drop view v; create view v as select
B.id_biletu...
Tomasz Myrta
---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Uz.ytkownik Stephan Szabo napisa?:
I see these two queries that in 7.3 push the clause into the
subquery and I believe should have the same output:
create view v as
select
group_id,
a/sum_a as percent_a,
b/sum_b as percent_b
from
(select
group_id,
sum(a) as sum_a,
sum(b) as su
> The other forms only move the filtering clauses around. There's
> still only a filter on the outer group_id equaling the inner
> group_id and a filter on group_id=3. It's just a question of
> whether it's:
>
> Scan users in subselect from group_id=3, group and aggregate them
> and join wit
> On Wed, 23 Oct 2002, Tomasz Myrta wrote:
>
> > Uz.ytkownik Stephan Szabo napisa?:
> Without group_id in the select list you couldn't do a where
> group_id = if the select was a view.
I know - it was just example of query.
> Did you see the other two queries I gave? On 7.3, both of those queri
On Wed, 23 Oct 2002, Tomasz Myrta wrote:
> > On Wed, 23 Oct 2002, Tomasz Myrta wrote:
> >
> > > Uz.ytkownik Stephan Szabo napisa?:
> > Without group_id in the select list you couldn't do a where
> > group_id = if the select was a view.
> I know - it was just example of query.
>
> > Did you see t
On Wed, 23 Oct 2002, Stephan Szabo wrote:
> Did you see the other two queries I gave? On 7.3, both of those queries
> appear (according to explain output) to do the limiting of group_id
> inside the subquery rather than doing the subquery with all rows.
> The explanation above was why I believe
On Wed, 23 Oct 2002, Tomasz Myrta wrote:
> Uz.ytkownik Stephan Szabo napisa?:
> > But you can't do that anyway, because you don't expose group_id
> > in the original query. I assume user_id was a mistake then and was
> > meant to be group_id or that both were meant to be in the
> > select list.
>
Uz.ytkownik Stephan Szabo napisa?:
But you can't do that anyway, because you don't expose group_id
in the original query. I assume user_id was a mistake then and was
meant to be group_id or that both were meant to be in the
select list.
Yes, I meant group_id, but in orginal query I didn't have t
On Wed, 23 Oct 2002, Tomasz Myrta wrote:
> Uz.ytkownik Stephan Szabo napisa?:
> > Does using X.group_id=3 in the where clause work better?
> It works better, but not if you want to create a view and make
> "select * from some_view where group_id=3" :-(
But you can't do that anyway, because you do
Uz.ytkownik Stephan Szabo napisa?:
Does using X.group_id=3 in the where clause work better?
It works better, but not if you want to create a view and make
"select * from some_view where group_id=3" :-(
On 7.3 with no statistics for the table, that appears
to move the filter into the subquery pl
On Wed, 23 Oct 2002, Tomasz Myrta wrote:
> Hi
> I want to perform query looking like this:
>
> select
> user_id,
> a/sum_a as percent_a,
> b/sum_b as percent_b
> from
> users join
> (select
> group_id,
> sum(a) as sum_a,
> sum(b) as sum_b
>from users group by group_id) X
Hi
I want to perform query looking like this:
select
user_id,
a/sum_a as percent_a,
b/sum_b as percent_b
from
users join
(select
group_id,
sum(a) as sum_a,
sum(b) as sum_b
from users group by group_id) X using (group_id)
where group_id=3;
This query works, but very slow. Subquery
14 matches
Mail list logo