Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOOBg-0000IM-64 for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 14:04:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fOOBe-0004Bk-Ts for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 14:04:18 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOOBe-0004BT-Cv for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 14:04:18 +0000 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fOOBZ-0006ge-JQ for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 14:04:17 +0000 Received: by mail-oi0-x242.google.com with SMTP id k5-v6so19591199oiw.0 for ; Thu, 31 May 2018 07:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=B9ASO61IqXPM2ZluCz96V7012AO+9VMjPFlvFCpIjHI=; b=nyj+/QQPeuvsPnLH8RQAeOCj42vpsaqAtH6zMPjRlMx/u7L5ltlzbz4cwJvxv/dPbV +x9+m3lsUNbFjvnDg/6xL4LZy5GBkjEoKydvHtgvJ6NskTHvUl8uosyIUV+33XFaJe/C 6czIV+k9AKJ9e/+Kga2BNTyDCKUbB+P38Xdor42zS2kTABIMzUzdfHd/2zsPtP1QeVoA 675SlpgcLQ8j2gA5gtAjRD0FTsX9orH9297hsr9ns7Yp24iFy1DGzadb4S1eHytXgy0q ZULVK1aqnmPdy3FtRIgUXrKwXaue7hdbT/9bK/SwRtJbGC5UQiRkMSjrCnunIcjXlkwh uO7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=B9ASO61IqXPM2ZluCz96V7012AO+9VMjPFlvFCpIjHI=; b=fYV9jSI5bG98yh2i3hxg2OgJYnfUpNYW2CJf0etb072jzPz1rgdCFAKs+5y3Azc1sW 8irQLYnz4II7PHznV14nBwP82yq7lRebvlfZqSp5CE7ntiiu8xcWWRkOJXqs0+e5SOoH QWhmo7qlE4lUqQxJGOvy6jjNnMcMOGpMZlpdA2KFeUos7DYIPGzHHqaDlfNzmsel23t8 JL+f5jwspPkwehEbSNITj9OUXlee9Efx4pW7LPj+4N1kEjFZQguCxfWZcu/Ik5qoPcHt 3pnYsxmWb5P6+oZ8OY9QCzLwiVg88bSoV/SAXer3vs0bGESaOT/vGeovsCS9Jy9Ei92Z hd/A== X-Gm-Message-State: ALKqPweaxjrJItVoO6UuN2rzWIe6UiilwNB5A18CVbYs1RuuOFZ3SU2x oDwndrf8fUUARXHqpmFbkwtquQ== X-Google-Smtp-Source: ADUXVKIyNlFvu37N/qSSRRjklrRd04oo/PTVtRF5ecOpyBUB7FpHeSg4WBkL7Fu1wA93cb3b4ws7kg== X-Received: by 2002:aca:5250:: with SMTP id g77-v6mr4167918oib.241.1527775452501; Thu, 31 May 2018 07:04:12 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id 8-v6sm21245860otu.39.2018.05.31.07.04.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 07:04:11 -0700 (PDT) Subject: Re: Question on disk contention To: pgsql-general@lists.postgresql.org References: <024f01d3f89e$323e20d0$96ba6270$@swisspug.org> From: Ron Message-ID: <88441bd2-0118-67b7-60b4-a0afa59a326e@gmail.com> Date: Thu, 31 May 2018 09:04:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------76824494A6462DAB63068D65" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------76824494A6462DAB63068D65 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 05/31/2018 08:52 AM, Melvin Davidson wrote: > > > On Thu, May 31, 2018 at 1:13 AM, Charles Clavadetscher > > wrote: > > Hi Melvin > > As an answer to a previous post you wrote: > > "Also, your main problem is that when you have two exact same queries > executing at the same time, they will cause contention in > the disk, and neither one will make much progress." > > Could you elaborate a little more on the meaning of "contention in the > disk"? > What is it that happens? > > Thank you and have a good day. > Regards > Charles > > > > >Could you elaborate a little more on the meaning of "contention in the disk"? > >What is it that happens? > > To simplify, you have two users/jobs, both wanting the exact same > information. So the system instructs the disk to get > that information from the disk, which causes the disk head to "seek" to > the position of the first eligible row and > continues positioning to other eligible rows. Now the job is not > exclusive, so the system temporarily switches to the > other job, which causes the disk to go back to the first row and work from > there. The switching back and forth continues, > so that instead of one job finishing quickly, they both have to take turns > waiting for needed information. That takes > a lot longer, > > Try this, Select a table that has a lot of rows, ideally 1M+. Then start a > query with a WHERE clause and see how long > it takes. Then submit the same query from 5 separate connections > simultaneously and see how long that takes. Why isn't the OS caching the disk blocks, and why isn't Postgres using the cached data? -- Angular momentum makes the world go 'round. --------------76824494A6462DAB63068D65 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit On 05/31/2018 08:52 AM, Melvin Davidson wrote:


On Thu, May 31, 2018 at 1:13 AM, Charles Clavadetscher <clavadetscher@swisspug.org> wrote:
Hi Melvin

As an answer to a previous post you wrote:

"Also, your main problem is that when you have two exact same queries executing at the same time, they will cause contention in
the disk, and neither one will make much progress."

Could you elaborate a little more on the meaning of "contention in the disk"?
What is it that happens?

Thank you and have a good day.
Regards
Charles



>Could you elaborate a little more on the meaning of "contention in the disk"?
>What is it that happens?

To simplify, you have two users/jobs, both wanting the exact same information. So the system instructs the disk to get
that information from the disk, which causes the disk head to "seek" to the position of the first eligible row and
continues positioning to other eligible rows. Now the job is not exclusive, so the system temporarily switches to the
other job, which causes the disk to go back to the first row and work from there. The switching back and forth continues,
so that instead of one job finishing quickly, they both have to take turns waiting for needed information. That takes
a lot longer,

Try this, Select a table that has a lot of rows, ideally 1M+. Then start a query with a WHERE clause and see how long
it takes. Then submit the same query from 5 separate connections simultaneously and see how long that takes.

Why isn't the OS caching the disk blocks, and why isn't Postgres using the cached data?


--
Angular momentum makes the world go 'round.
--------------76824494A6462DAB63068D65--