Hacker News new | ask | show | jobs
by kiwicopple 1281 days ago
I understand now, and this is a similar problem to how some GraphQL engines work

I imagine you want to do something like:

    select 
        *
    from 
        public.users join stripe.customers
    on
        public.users.stripe_id = stripe.customers.id
    limit 100;
Then yes, it might make 100 consecutive calls to your stripe account. There are 3 options here:

1. Materialize your customers into your database (like I mention in the previous comment)

2. We build a "smart" FDW, so that it parses your query and fetches the Stripe data first, then performs the join.

3. Use a CTE:

    with
    customers as (
        select * from stripe.customers
    ),
    users as (
        select * from public.users
    )
    select 
        *
    from 
        users join customers
    on
        users.stripe_id = customers.id
1 comments

4. Use a local http cache in front of stripe's api. This is basically "external materialization".