pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feeddblink without running the full query remotely?
4+ messages / 3 participants
[nested] [flat]
* dblink without running the full query remotely?
@ 2023-08-25 18:20 Wells Oliver <wells.oliver@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Wells Oliver @ 2023-08-25 18:20 UTC (permalink / raw)
To: pgsql-admin
Per the documentation -- *dblink fetches the entire remote query result
before returning any of it to the local system* -- I am guessing the answer
is no, but I wondered if there was some way to do something like this:
create view myview as;
select * from dblink(
'server',
'select id from sometable')
cols(id bigint);
And then
select * from myview where id = 123;
Where that remote sometable might have a bajillion rows and the local where
would be passed to it otherwise it's days and days for all rows to be
returned and then filtered.
--
Wells Oliver
wells.oliver@gmail.com <wellsoliver@gmail.com>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: dblink without running the full query remotely?
@ 2023-08-25 21:16 Tom Lane <tgl@sss.pgh.pa.us>
parent: Wells Oliver <wells.oliver@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2023-08-25 21:16 UTC (permalink / raw)
To: Wells Oliver <wells.oliver@gmail.com>; +Cc: pgsql-admin
Wells Oliver <wells.oliver@gmail.com> writes:
> Per the documentation -- *dblink fetches the entire remote query result
> before returning any of it to the local system* -- I am guessing the answer
> is no, but I wondered if there was some way to do something like this:
> ...
> Where that remote sometable might have a bajillion rows and the local where
> would be passed to it
No, and it's unlikely anyone would ever put effort into making dblink
do that, because the newer foreign table (FDW) code *does* handle that
sort of thing. dblink still has its uses, but it's pretty much at a
dead end developmentally. Take a look at postgres_fdw.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: dblink without running the full query remotely?
@ 2023-08-25 22:12 Wells Oliver <wells.oliver@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Wells Oliver @ 2023-08-25 22:12 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
Thanks, this it exactly.
Correlated, is there a way to define a fdw user mapping for a role versus
for every single individual user in a database?
On Fri, Aug 25, 2023 at 2:16 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Wells Oliver <wells.oliver@gmail.com> writes:
> > Per the documentation -- *dblink fetches the entire remote query result
> > before returning any of it to the local system* -- I am guessing the
> answer
> > is no, but I wondered if there was some way to do something like this:
> > ...
> > Where that remote sometable might have a bajillion rows and the local
> where
> > would be passed to it
>
> No, and it's unlikely anyone would ever put effort into making dblink
> do that, because the newer foreign table (FDW) code *does* handle that
> sort of thing. dblink still has its uses, but it's pretty much at a
> dead end developmentally. Take a look at postgres_fdw.
>
> regards, tom lane
>
--
Wells Oliver
wells.oliver@gmail.com <wellsoliver@gmail.com>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: dblink without running the full query remotely?
@ 2023-08-25 22:26 M Sarwar <sarwarmd02@outlook.com>
parent: Wells Oliver <wells.oliver@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: M Sarwar @ 2023-08-25 22:26 UTC (permalink / raw)
To: Wells Oliver <wells.oliver@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
Probably this is neither possible in Oracle nor in Postgres.
If you are willing to take a complex route, Postgres will allow you to point to PUBLIC schema where you will need to export the objects at least once for each schema from the source environment.
I hope that I am not slipping any thing.
Thanks,
Sarwar
________________________________
From: Wells Oliver <wells.oliver@gmail.com>
Sent: Friday, August 25, 2023 6:12 PM
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: dblink without running the full query remotely?
Thanks, this it exactly.
Correlated, is there a way to define a fdw user mapping for a role versus for every single individual user in a database?
On Fri, Aug 25, 2023 at 2:16 PM Tom Lane <tgl@sss.pgh.pa.us<mailto:tgl@sss.pgh.pa.us>> wrote:
Wells Oliver <wells.oliver@gmail.com<mailto:wells.oliver@gmail.com>> writes:
> Per the documentation -- *dblink fetches the entire remote query result
> before returning any of it to the local system* -- I am guessing the answer
> is no, but I wondered if there was some way to do something like this:
> ...
> Where that remote sometable might have a bajillion rows and the local where
> would be passed to it
No, and it's unlikely anyone would ever put effort into making dblink
do that, because the newer foreign table (FDW) code *does* handle that
sort of thing. dblink still has its uses, but it's pretty much at a
dead end developmentally. Take a look at postgres_fdw.
regards, tom lane
--
Wells Oliver
wells.oliver@gmail.com<mailto:wellsoliver@gmail.com>
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-08-25 22:26 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25 18:20 dblink without running the full query remotely? Wells Oliver <wells.oliver@gmail.com>
2023-08-25 21:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-08-25 22:12 ` Wells Oliver <wells.oliver@gmail.com>
2023-08-25 22:26 ` M Sarwar <sarwarmd02@outlook.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox