From: | Anton <anton200(at)gmail(dot)com> |
---|---|
To: | "Sergey Suleymanov" <solt(at)eatpbank(dot)ru> |
Cc: | pgsql-ru-general(at)postgresql(dot)org |
Subject: | Re: SELECT ... WHERE ... IN (SELECT ...) -> |
Date: | 2006-12-05 07:01:05 |
Message-ID: | 8cac8dd0612042301l66cd8f89xe1ef40fca5caaec@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-ru-general |
> А если таки явно нарисовать join ?
то ничего не меняется, т.к. оно как раз это вроде бы само-то и делает.
=# explain analyze
billing-# SELECT n_traffic.collect_time
billing-# FROM n_logins
billing-# JOIN n_traffic ON (n_traffic.login_id = n_logins.login_id AND
billing(# n_traffic.collect_time >
'1970-01-01 00:00:00')
billing-# WHERE n_logins.account_id = '1655'
billing-# ORDER BY n_traffic.collect_time, n_traffic.login_id LIMIT 1;
---------------------------------------
Limit (cost=0.00..2029.81 rows=1 width=12) (actual
time=5473.602..5473.602 rows=0 loops=1)
-> Nested Loop (cost=0.00..876879.12 rows=432 width=12) (actual
time=5473.595..5473.595 rows=0 loops=1)
-> Index Scan using n_traffic_collect_time_login_id on
n_traffic (cost=0.00..11094.75 rows=273472 width=12) (actual
time=0.036..1130.476 rows=273486 loops=1)
Index Cond: (collect_time > '1970-01-01
00:00:00'::timestamp without time zone)
-> Index Scan using n_logins_pkey on n_logins
(cost=0.00..3.15 rows=1 width=4) (actual time=0.011..0.011 rows=0
loops=273486)
Index Cond: ("outer".login_id = n_logins.login_id)
Filter: (account_id = 1655)
Total runtime: 5473.843 ms
(8 rows)
--
engineer
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander M. Pravking | 2006-12-05 07:34:07 | Re: SELECT ... WHERE ... IN (SELECT ...) -> SELECT ... WHERE (... OR ... ) |
Previous Message | Anton | 2006-12-05 06:47:11 | Re: SELECT ... WHERE ... IN (SELECT ...) -> SELECT ... WHERE (... OR ... ) |