Re: Copy command Faster than original select

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Belal Al-Hamed <belalhamed(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Copy command Faster than original select
Date: 2015-02-06 08:54:36
Message-ID: CAFj8pRCjpih-swz_Ac-QC7FnEC0kNqcZCUcJdFUqokVDPrqxrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

2015-02-06 9:44 GMT+01:00 Belal Al-Hamed <belalhamed(at)gmail(dot)com>:

> thanks,
>
> but isn't copy use the same plan ???
>

aha - I was wrong,

this slowdown can be enforced by slow client (or slow network). pgAdmin is
not terrible fast. Try to execute your query from psql.

Regards

Pavel

>
> any way this is the query play
>
> "Sort (cost=15402.76..15511.77 rows=43602 width=184)"
> " Output: "Sessions"."SesUser", "Vouchers"."VouID",
> "Journals"."JurMuniment", "Journals"."JurRefID", "Journals"."JurDate",
> "Vouchers"."VouJournal", "Vouchers"."VouMunNumber", "Vouchers"."VouDate",
> "Vouchers"."VouNote", "Vouchers"."VouDoc", "Journals"."JurM (...)"
> " Sort Key: "VouItems"."ItmDate", "Vouchers"."VouID",
> "VouItems"."ItmNumber""
> " -> Hash Join (cost=4665.21..8164.77 rows=43602 width=184)"
> " Output: "Sessions"."SesUser", "Vouchers"."VouID",
> "Journals"."JurMuniment", "Journals"."JurRefID", "Journals"."JurDate",
> "Vouchers"."VouJournal", "Vouchers"."VouMunNumber", "Vouchers"."VouDate",
> "Vouchers"."VouNote", "Vouchers"."VouDoc", "Journals" (...)"
> " Hash Cond: ("VouItems"."ItmMaster" = "Vouchers"."VouID")"
> " -> Seq Scan on public."VouItems" (cost=0.00..1103.02 rows=43602
> width=89)"
> " Output: "VouItems"."ItmMaster", "VouItems"."ItmNumber",
> "VouItems"."ItmCurDebit", "VouItems"."ItmCurCredit",
> "VouItems"."ItmAccount", "VouItems"."ItmBranch",
> "VouItems"."ItmSubAccount",
> "VouItems"."ItmMuniment", "VouItems"."ItmDate", "VouItem (...)"
> " -> Hash (cost=4107.41..4107.41 rows=20544 width=95)"
> " Output: "Vouchers"."VouID", "Vouchers"."VouJournal",
> "Vouchers"."VouMunNumber", "Vouchers"."VouDate", "Vouchers"."VouNote",
> "Vouchers"."VouDoc", "Vouchers"."VouIsHold", "Vouchers"."VouCreateDate",
> "Vouchers"."VouDebit", "Vouchers"."VouCredit" (...)"
> " -> Hash Join (cost=1793.25..4107.41 rows=20544 width=95)"
> " Output: "Vouchers"."VouID", "Vouchers"."VouJournal",
> "Vouchers"."VouMunNumber", "Vouchers"."VouDate", "Vouchers"."VouNote",
> "Vouchers"."VouDoc", "Vouchers"."VouIsHold", "Vouchers"."VouCreateDate",
> "Vouchers"."VouDebit", "Vouchers"."VouC (...)"
> " Hash Cond: ("Vouchers"."VouJournal" =
> "Journals"."JurID")"
> " -> Hash Join (cost=1236.16..3165.12 rows=20544
> width=74)"
> " Output: "Vouchers"."VouID",
> "Vouchers"."VouJournal", "Vouchers"."VouMunNumber", "Vouchers"."VouDate",
> "Vouchers"."VouNote", "Vouchers"."VouDoc", "Vouchers"."VouIsHold",
> "Vouchers"."VouCreateDate", "Vouchers"."VouDebit", "Vouchers" (...)"
> " Hash Cond: ("Vouchers"."VouSession" =
> "Sessions"."SesID")"
> " -> Seq Scan on public."Vouchers"
> (cost=0.00..883.44 rows=20544 width=78)"
> " Output: "Vouchers"."VouID",
> "Vouchers"."VouJournal", "Vouchers"."VouMunNumber", "Vouchers"."VouDate",
> "Vouchers"."VouNote", "Vouchers"."VouDoc", "Vouchers"."VouIsHold",
> "Vouchers"."VouCreateDate", "Vouchers"."VouDebit", "Vou (...)"
> " -> Hash (cost=654.85..654.85 rows=33385
> width=12)"
> " Output: "Sessions"."SesUser",
> "Sessions"."SesID""
> " -> Seq Scan on public."Sessions"
> (cost=0.00..654.85 rows=33385 width=12)"
> " Output: "Sessions"."SesUser",
> "Sessions"."SesID""
> " -> Hash (cost=417.04..417.04 rows=11204 width=29)"
> " Output: "Journals"."JurMuniment",
> "Journals"."JurRefID", "Journals"."JurDate", "Journals"."JurMunNumber",
> "Journals"."JurID""
> " -> Seq Scan on public."Journals"
> (cost=0.00..417.04 rows=11204 width=29)"
> " Output: "Journals"."JurMuniment",
> "Journals"."JurRefID", "Journals"."JurDate", "Journals"."JurMunNumber",
> "Journals"."JurID""
>
>
>
>
> --
> View this message in context:
> http://postgresql.nabble.com/Copy-command-Faster-than-original-select-tp5836886p5836890.html
> Sent from the PostgreSQL - performance mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Belal Al-Hamed 2015-02-06 09:15:38 Re: Copy command Faster than original select
Previous Message Belal Al-Hamed 2015-02-06 08:44:29 Re: Copy command Faster than original select