pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Joining between large & small tables?
7+ messages / 6 participants
[nested] [flat]

* Joining between large & small tables?
@ 2020-07-14 01:39  Wells Oliver <wells.oliver@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Wells Oliver @ 2020-07-14 01:39 UTC (permalink / raw)
  To: pgsql-admin

Given a large large large table A and a small small temp table B is there
any benefit to doing SELECT * FROM a JOIN b USING (somecol) vs SELECT *
FROM b JOIN a USING (somecol)?

When you just want the intersection...

-- 
Wells Oliver
wells.oliver@gmail.com <wellsoliver@gmail.com>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Joining between large & small tables?
@ 2020-07-14 01:42  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: Wells Oliver <wells.oliver@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Scott Ribe @ 2020-07-14 01:42 UTC (permalink / raw)
  To: Wells Oliver <wells.oliver@gmail.com>; +Cc: pgsql-admin

> On Jul 13, 2020, at 7:39 PM, Wells Oliver <wells.oliver@gmail.com> wrote:
> 
> Given a large large large table A and a small small temp table B is there any benefit to doing SELECT * FROM a JOIN b USING (somecol) vs SELECT * FROM b JOIN a USING (somecol)?
> 
> When you just want the intersection...

No, planner will figure out how to join based on stats, not order. (With default planner options; there are ways to work around that in the rare case that the planner can't figure out the best way.)




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Joining between large & small tables?
@ 2020-07-14 01:44  David G. Johnston <david.g.johnston@gmail.com>
  parent: Wells Oliver <wells.oliver@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: David G. Johnston @ 2020-07-14 01:44 UTC (permalink / raw)
  To: Wells Oliver <wells.oliver@gmail.com>; +Cc: pgsql-admin

On Mon, Jul 13, 2020 at 6:40 PM Wells Oliver <wells.oliver@gmail.com> wrote:

> Given a large large large table A and a small small temp table B is there
> any benefit to doing SELECT * FROM a JOIN b USING (somecol) vs SELECT *
> FROM b JOIN a USING (somecol)?
>

https://www.postgresql.org/docs/12/explicit-joins.html

David J.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* \set to create shortcut
@ 2024-02-22 08:32  Fabrice Chapuis <fabrice636861@gmail.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Fabrice Chapuis @ 2024-02-22 08:32 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hi,
I want to persist a shortcut between session.


> postgres [157394]=# \set cs 'select current_schema';
> postgres [157394]=# :cs
> ┌────────────────┐
> │ current_schema │
> ├────────────────┤
> │ public         │
> └────────────────┘
> (1 row)


I put it in .pgsql_profile but it does not work

any idea?


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: \set to create shortcut
@ 2024-02-22 08:45  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Fabrice Chapuis <fabrice636861@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Laurenz Albe @ 2024-02-22 08:45 UTC (permalink / raw)
  To: Fabrice Chapuis <fabrice636861@gmail.com>; pgsql-admin@lists.postgresql.org

On Thu, 2024-02-22 at 09:32 +0100, Fabrice Chapuis wrote:
> I want to persist a shortcut between session.
>  
> > postgres [157394]=# \set cs 'select current_schema';
> > postgres [157394]=# :cs
> > ┌────────────────┐
> > │ current_schema │
> > ├────────────────┤
> > │ public         │
> > └────────────────┘
> > (1 row)
> 
> I put it in .pgsql_profile but it does not work
> 
> any idea?

It works for me if I put the semicolon inside the single quotes.

Yours,
Laurenz Albe


^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: \set to create shortcut
@ 2024-02-22 09:32  Erik Wienhold <ewie@ewie.name>
  parent: Fabrice Chapuis <fabrice636861@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Erik Wienhold @ 2024-02-22 09:32 UTC (permalink / raw)
  To: Fabrice Chapuis <fabrice636861@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

On 2024-02-22 09:32 +0100, Fabrice Chapuis wrote:
> I want to persist a shortcut between session.
> 
> 
> > postgres [157394]=# \set cs 'select current_schema';
> > postgres [157394]=# :cs
> > ┌────────────────┐
> > │ current_schema │
> > ├────────────────┤
> > │ public         │
> > └────────────────┘
> > (1 row)
> 
> 
> I put it in .pgsql_profile but it does not work
> 
> any idea?

What output do you get?

You should put that \set or \ir .pgsql_profile in .psqlrc which is the
standard file read by psql.

-- 
Erik





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: \set to create shortcut
@ 2024-02-22 11:19  Fabrice Chapuis <fabrice636861@gmail.com>
  parent: Erik Wienhold <ewie@ewie.name>
  0 siblings, 0 replies; 7+ messages in thread

From: Fabrice Chapuis @ 2024-02-22 11:19 UTC (permalink / raw)
  To: Erik Wienhold <ewie@ewie.name>; +Cc: pgsql-admin@lists.postgresql.org

Ok I put it  .psqlrc file. It works. Thanks to you
Fabrice

On Thu, Feb 22, 2024 at 10:32 AM Erik Wienhold <ewie@ewie.name> wrote:

> On 2024-02-22 09:32 +0100, Fabrice Chapuis wrote:
> > I want to persist a shortcut between session.
> >
> >
> > > postgres [157394]=# \set cs 'select current_schema';
> > > postgres [157394]=# :cs
> > > ┌────────────────┐
> > > │ current_schema │
> > > ├────────────────┤
> > > │ public         │
> > > └────────────────┘
> > > (1 row)
> >
> >
> > I put it in .pgsql_profile but it does not work
> >
> > any idea?
>
> What output do you get?
>
> You should put that \set or \ir .pgsql_profile in .psqlrc which is the
> standard file read by psql.
>
> --
> Erik
>


^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2024-02-22 11:19 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 01:39 Joining between large & small tables? Wells Oliver <wells.oliver@gmail.com>
2020-07-14 01:42 ` Scott Ribe <scott_ribe@elevated-dev.com>
2020-07-14 01:44 ` David G. Johnston <david.g.johnston@gmail.com>
2024-02-22 08:32 \set to create shortcut Fabrice Chapuis <fabrice636861@gmail.com>
2024-02-22 08:45 ` Re: \set to create shortcut Laurenz Albe <laurenz.albe@cybertec.at>
2024-02-22 09:32 ` Re: \set to create shortcut Erik Wienhold <ewie@ewie.name>
2024-02-22 11:19   ` Re: \set to create shortcut Fabrice Chapuis <fabrice636861@gmail.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