Open kaidaguerre opened 3 years ago
As @johnsmyth suggested, using in
instead of =
works ... which is great, but I believe the =
should still work in this case.
> select id, text from twitter_user_tweet_timeline where author_id in (select id from twitter_user where username = 'steampipeio')
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id | text |
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1373134228620214275 | 𝚜𝚎𝚕𝚎𝚌𝚝 * 𝚏𝚛𝚘𝚖 𝚌𝚕𝚘𝚞𝚍; |
| | |
| | 60 seconds of awesome! Watch the Steampipe CLI demo: https://t.co/IPilF4u38R |
| 1374512803063623688 | @JensenKarp @CTCSquares One person's delicacy is another's tweet storm... See the world through our #rowscoloredglasses | https://t.co/FTuBWA9EPV https://t.co/4atmjhoJhM |
| 1373023688862408710 | New: Steampipe v0.3.0 |
| | |
| | - Query caching |
| | - Configuration settings |
| | - Improved quals for mind-blowing joins |
| | |
| | https://t.co/GsWqO3k6p7 |
| 1354121537637511168 | RT @turbothq: Introducing Steampipe: 𝚜𝚎𝚕𝚎𝚌𝚝 * 𝚏𝚛𝚘𝚖 𝚌𝚕𝚘𝚞𝚍; |
| | Open source. Download at https://t.co/fsj9Fy23av https://t.co/6Ct3l8PZht |
+---------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
>
this is the same issue as https://github.com/turbot/steampipe-postgres-fdw/issues/46
the query plan for =
is
explain select id, text from twitter_user_tweet where user_id = (select id from twitter_user where username = 'steampipeio')
+--------------------------------------------------------------------------------------------------------+
| QUERY PLAN |
+--------------------------------------------------------------------------------------------------------+
| Foreign Scan on twitter_user_tweet (cost=20000000000000.00..50000000000000.00 rows=1000000 width=300) |
| Filter: (user_id = $0) |
| InitPlan 1 (returns $0) |
| -> Foreign Scan on twitter_user (cost=0.00..20000000000000.00 rows=1000000 width=200) |
| Filter: (username = 'steampipeio'::text) |
+--------------------------------------------------------------------------------------------------------+
>
the query plan for in
is
explain select id, text from twitter_user_tweet where user_id in (select id from twitter_user where username = 'steampipeio')
+-------------------------------------------------------------------------------------------------+
| QUERY PLAN |
+-------------------------------------------------------------------------------------------------+
| Nested Loop (cost=20000000002500.00..20000000002800.02 rows=500000 width=64) |
| -> HashAggregate (cost=20000000002500.00..20000000002500.01 rows=1 width=200) |
| Group Key: twitter_user.id |
| -> Foreign Scan on twitter_user (cost=0.00..20000000000000.00 rows=1000000 width=200) |
| Filter: (username = 'steampipeio'::text) |
| -> Foreign Scan on twitter_user_tweet (cost=0.00..300.00 rows=1 width=300) |
| Filter: (user_id = twitter_user.id) |
+-------------------------------------------------------------------------------------------------+
The join works, but the sub-select does not. Also interesting is that the log shows a ? as the value: