Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jvKKi-0000RS-Gd for pgsql-general@arkaria.postgresql.org; Tue, 14 Jul 2020 12:46:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jvKKh-0001Nj-AB for pgsql-general@arkaria.postgresql.org; Tue, 14 Jul 2020 12:46:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jvKKg-0001Nc-Ve for pgsql-general@lists.postgresql.org; Tue, 14 Jul 2020 12:46:51 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jvKKZ-0007r1-Lm for pgsql-general@lists.postgresql.org; Tue, 14 Jul 2020 12:46:50 +0000 Received: by mail-qt1-x842.google.com with SMTP id d27so12618686qtg.4 for ; Tue, 14 Jul 2020 05:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=americanefficient-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=t97uOnC0+bF8z1rL0J1SErf9GkbtFwGS2TvMR62IWHM=; b=sQEynJKZz+w/PDNJgY5ts2T2N1ZWj2VvoIbIEmWCmmkO8gkK2shHT3EANx2bFRufrH /09MrGpztjcoS+kCdMiRNcReexnuF77F6vgvCrmb/y7NBZ/uj1JTaAjgEf0qwoXW6KTU AHLfPTimLADvWlkVAqEheT4anJuWsCPm2JC6yLA2sbfygJRJxIADkURButF3w6Bq1zjb dxRZ3+vMhGfRlaSMQdnf3N6BY89Zz9aL4t61yUrEAeer6TpyVcKGwxBxx6cJG5P3x9Ii jSUcbBxCU/C3ZO8SvdVJsKYUVQZthWR3FKdjuIwgeZvsrxKpzyt3KDKcH4i3wNnX9vls Vrvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=t97uOnC0+bF8z1rL0J1SErf9GkbtFwGS2TvMR62IWHM=; b=hsGO7qHjx4Q0mOlchAdsJBNErBhZd4LuY3eZ1k+Qa1anLhRRrXvztiDy1wUHYznQEX lI7dBxYHQ43PmIj7L1PsRZEiVD8pTmRn7i3O9Ew6Kw9WDZBPny8EgGK0aidBxG52/As4 Zo0auCwXyuFygP5bFg/iwo0n1Lv/gA7CcnSWZTofqlgc6Z8zjYV3nBwYTku7PZG447gF IZnj8W69dypVXwguWM27tH1+aZDTsLqsaOMQ7+lZmY/R5vhanFrOEu0EsuCnbYbnfjRI FzFwIjfMzIGD4X+H3xvwUE5q+APWSm3YWQNcLxF6wpRW/2t+oFHMz2pa3pRIjh+W6EFv XwcA== X-Gm-Message-State: AOAM531z9eUYqXarxVh2G95Ki7TOkIEcxjeko3vX9Mwq/6KLbGWtfMRO LizjuhqkP3Evu9XXmXEhYyTC7w== X-Google-Smtp-Source: ABdhPJyytd0sJkFwSqP29bpX4QPjbJ44gkV6O5e/NwCasWXXKamMZ5iylOem5UY6/a6hinA2qK8Diw== X-Received: by 2002:ac8:346c:: with SMTP id v41mr4472403qtb.262.1594730802023; Tue, 14 Jul 2020 05:46:42 -0700 (PDT) Received: from [10.0.1.8] (user-10lff1p.cable.mindspring.com. [65.87.188.57]) by smtp.gmail.com with ESMTPSA id r2sm21656353qtn.27.2020.07.14.05.46.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2020 05:46:41 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Same query taking less time in low configuration machine From: Philip Semanchuk In-Reply-To: Date: Tue, 14 Jul 2020 08:46:40 -0400 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <5BCF8F9B-30A5-44AB-80C2-8C23424C38B2@americanefficient.com> References: To: Vishwa Kalyankar X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Jul 14, 2020, at 5:27 AM, Vishwa Kalyankar = wrote: >=20 > Hi, =20 >=20 > 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/#/=20 >=20 >=20 > Below I am pasting the output of query explain in both the machines. >=20 > -bash-4.2$ psql -p 5434 > psql (12.3) > Type "help" for help. >=20 > postgres=3D# \c IPDS_KSEB; > You are now connected to database "IPDS_KSEB" as user "postgres". > IPDS_KSEB=3D# explain analyze select * from = kseb_geometry_trace_with_barrier_partition(5,'kottarakara_version',437,'ht= line',2) ; > = QUERY PLAN > = --------------------------------------------------------------------------= --------------------------------------------------------------------------= ----- > Function Scan on kseb_geometry_trace_with_barrier_partition = (cost=3D0.25..10.25 rows=3D1000 width=3D169) (actual = time=3D11626.548..11626.568 rows=3D254 loops=3D1) > Planning Time: 0.212 ms > Execution Time: 11628.590 ms >=20 >=20 > -bash-4.2$ psql -p 5422 > psql (12.3) > Type "help" for help. >=20 > postgres=3D# \c IPDS_KSEB; > You are now connected to database "IPDS_KSEB" as user "postgres". > IPDS_KSEB=3D# explain analyze select * from = kseb_geometry_trace_with_barrier_partition(5,'kottarakara_version',437,'ht= line',2) ; > = QUERY PLAN > = --------------------------------------------------------------------------= --------------------------------------------------------------------------= ----- > Function Scan on kseb_geometry_trace_with_barrier_partition = (cost=3D0.25..10.25 rows=3D1000 width=3D169) (actual = time=3D22304.425..22304.448 rows=3D254 loops=3D1) > Planning Time: 0.219 ms > Execution Time: 22352.219 ms > (3 rows) >=20 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=E2=80=99s both the Postgres cache and = the OS disk cache to consider. You can see what=E2=80=99s in the = Postgres cache with an extension like pg_buffercache. I don=E2=80=99t = know of a way to see what=E2=80=99s in the OS cache; maybe others do. Cheers Philip