From: Philip Semanchuk <philip@americanefficient.com>
To: Vishwa Kalyankar <vishwakalyankar8@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Same query taking less time in low configuration machine
Date: Tue, 14 Jul 2020 08:46:40 -0400
Message-ID: <5BCF8F9B-30A5-44AB-80C2-8C23424C38B2@americanefficient.com> (raw)
In-Reply-To: <CAFWaVn3D2d_15otF=kC8X=ECSAv0rhcccp_bK_7SqLj9UsK8TA@mail.gmail.com>
References: <CAFWaVn3D2d_15otF=kC8X=ECSAv0rhcccp_bK_7SqLj9UsK8TA@mail.gmail.com>
> On Jul 14, 2020, at 5:27 AM, Vishwa Kalyankar <vishwakalyankar8@gmail.com> wrote:
>
> Hi,
>
> I have two machines - one with 8GB RAM & 4core CPU and the other with 64GB Ram & 24 core CPU. Both machines have the same DB (Postgres 12 + Postgis 2.5.3). Same query is taking less time in low end machine whereas more time in high end machine. Any thoughts on where to look? I have tuned the db in both machines according to https://pgtune.leopard.in.ua/#/
>
>
> Below I am pasting the output of query explain in both the machines.
>
> -bash-4.2$ psql -p 5434
> psql (12.3)
> Type "help" for help.
>
> postgres=# \c IPDS_KSEB;
> You are now connected to database "IPDS_KSEB" as user "postgres".
> IPDS_KSEB=# explain analyze select * from kseb_geometry_trace_with_barrier_partition(5,'kottarakara_version',437,'htline',2) ;
> QUERY PLAN
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
> Function Scan on kseb_geometry_trace_with_barrier_partition (cost=0.25..10.25 rows=1000 width=169) (actual time=11626.548..11626.568 rows=254 loops=1)
> Planning Time: 0.212 ms
> Execution Time: 11628.590 ms
>
>
> -bash-4.2$ psql -p 5422
> psql (12.3)
> Type "help" for help.
>
> postgres=# \c IPDS_KSEB;
> You are now connected to database "IPDS_KSEB" as user "postgres".
> IPDS_KSEB=# explain analyze select * from kseb_geometry_trace_with_barrier_partition(5,'kottarakara_version',437,'htline',2) ;
> QUERY PLAN
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
> Function Scan on kseb_geometry_trace_with_barrier_partition (cost=0.25..10.25 rows=1000 width=169) (actual time=22304.425..22304.448 rows=254 loops=1)
> Planning Time: 0.219 ms
> Execution Time: 22352.219 ms
> (3 rows)
>
Hi Vishwa,
Is it possible that your data is in the cache on the low end machine but not on the high end machine? There’s both the Postgres cache and the OS disk cache to consider. You can see what’s in the Postgres cache with an extension like pg_buffercache. I don’t know of a way to see what’s in the OS cache; maybe others do.
Cheers
Philip
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: philip@americanefficient.com, vishwakalyankar8@gmail.com
Subject: Re: Same query taking less time in low configuration machine
In-Reply-To: <5BCF8F9B-30A5-44AB-80C2-8C23424C38B2@americanefficient.com>
References: <CAFWaVn3D2d_15otF=kC8X=ECSAv0rhcccp_bK_7SqLj9UsK8TA@mail.gmail.com> <5BCF8F9B-30A5-44AB-80C2-8C23424C38B2@americanefficient.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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