Re: SELECT ... WHERE ... IN (SELECT ...) -> - Mailing list pgsql-ru-general

From Anton
Subject Re: SELECT ... WHERE ... IN (SELECT ...) ->
Date
Msg-id 8cac8dd0612042301l66cd8f89xe1ef40fca5caaec@mail.gmail.com
Whole thread Raw
In response to Re: SELECT ... WHERE ... IN (SELECT ...) ->  (Sergey Suleymanov <solt@eatpbank.ru>)
Responses Re: SELECT ... WHERE ... IN (SELECT ...) ->  ("Alexander M. Pravking" <fduch@antar.bryansk.ru>)
List 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

pgsql-ru-general by date:

Previous
From: Anton
Date:
Subject: Re: SELECT ... WHERE ... IN (SELECT ...) -> SELECT ... WHERE (... OR ... )
Next
From: "Alexander M. Pravking"
Date:
Subject: Re: SELECT ... WHERE ... IN (SELECT ...) -> SELECT ... WHERE (... OR ... )