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 1g2X9k-0004iW-9z for pgsql-general@arkaria.postgresql.org; Wed, 19 Sep 2018 07:44:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g2X9i-0003EN-OU for pgsql-general@arkaria.postgresql.org; Wed, 19 Sep 2018 07:44:14 +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 1g2X9i-0003E4-Dj for pgsql-general@lists.postgresql.org; Wed, 19 Sep 2018 07:44:14 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g2X9f-0001xM-9S for pgsql-general@lists.postgresql.org; Wed, 19 Sep 2018 07:44:13 +0000 Received: by mail-wm1-x32a.google.com with SMTP id j192-v6so5696001wmj.1 for ; Wed, 19 Sep 2018 00:44:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Vgx7w88wBlzDjUaYPlpyvchXpinSLwplorZF9hLmb1Y=; b=gn9xUN8iU82GU1WXYU80gC1oQiyYu2osnzKaHh4MSW3j2sAZXUyOE+mLbKxpIcx2Dx QNOz1bXAmJrQiD63Fcv6sxhpfLkcf8k79TPsIx4KATL3TMlByNEIo7ie0nsA/2wzUadS VsqM9AdT5WIGfORXGqLVIwvj1XY3d5emXEv1opAzSHDc6Aok+CFdj8r5VEDYD+dq69ii UbkZMBRvFV3oFGSY/01Q2NCZ/VygRRKMwIYLt6kCX4u2rmh4TMInJBNf7Aq3fT2+Qokr YnfZRCu3ooTsA+3CCJKi7ADyjH7lWcydbKMwGSkLKhTX2RKw6eEjFMgWEE+wdw0mqcYa 6F1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Vgx7w88wBlzDjUaYPlpyvchXpinSLwplorZF9hLmb1Y=; b=mDdH1XWII2aoovDSpfUWLLAIM0i6ifo3cBYchOgaEc4nCBM2fC9NchflFjKVxDHRId Zp7uwemd53l5bZunZuM9BmrB5CHxm+tpqwaYwf6AhZwdLuTKq+bjpBa2gAjuJt8Zkqz/ aaN0WgBsugwjbuW4ksr0axa2chFU62rJoCIu895Xp2PMyp46VLLgt+C14HE5anSnSi36 J1sbgx4IKceeratqGhVeQ0hrSvicmPxBvv13WFJGQoJiAxANn3jom40B/NEm/o7I87vo vVezQnw3sd/cp58DPjbjKjWZfASZPc71FEC4mDtQSTe4snJb02WVI5zoDYhCi0xO2sja Q5XA== X-Gm-Message-State: APzg51Dtf7DaDq6/RV7Chaec8ASep6icVtqArsuF1+USU4TVexJ3Ak3o TStKzKr0C5CM7GuPbV4UjTBPGCFgXYZsoor1MN8v3Ueg6REA5X6SaLei+lyKOq6Sk28zLE02PHG lM211LbJaSp/F2Yrb8pD31PVFQtC2RltY9A6z/YmsvC+qhmqc6uuaTGFbIoUf6rqfzl8AwthTj6 V5OvK1WjaX5gP5FA== X-Google-Smtp-Source: ANB0Vda3tnYRUVl2yzi0+2ZS22Tkg2mZwwtuay55FZtQfPCng0WurR1pGeyVTPYOErGR6C1TaMBPnQ== X-Received: by 2002:a1c:8682:: with SMTP id i124-v6mr18093241wmd.77.1537343049023; Wed, 19 Sep 2018 00:44:09 -0700 (PDT) Received: from ?IPv6:2a01:e35:2ea4:c7c0:145d:b485:13c5:f5e? ([2a01:e35:2ea4:c7c0:145d:b485:13c5:f5e]) by smtp.gmail.com with ESMTPSA id 139-v6sm6398014wmp.4.2018.09.19.00.44.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 00:44:07 -0700 (PDT) Subject: Re: how to know whether query data from memory after pg_prewarm To: Thomas Munro , jimmy Cc: "pgsql-generallists.postgresql.org" References: <75890af2.262f.165ef76e5ef.Coremail.mpokky@126.com> From: =?UTF-8?Q?C=c3=a9dric_Villemain?= Organization: 2ndQuadrant Message-ID: Date: Wed, 19 Sep 2018 09:44:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Le 19/09/2018 à 05:29, Thomas Munro a écrit : > On Wed, Sep 19, 2018 at 1:35 PM jimmy wrote: >> I use select pg_prewarm('table1','read','main') to load data of table1 into the memory. >> when I use select count(1) from table1 group by aa to query data. >> I find the speed of query is not fast, I wonder whether it query data from memory. >> And it is slower than Oracle, both of Oracle and Postgresql has same table and count of data. >> when pg_prewarm use 'read' mode, the data is put into the OS cache, how to examine the table which is pg_prewarmed into the OS cache . >> I know pg_buffercache ,but it just examine the table in the shared buffer of Postgresql, not the table in the OS cache. > > This is a quick and dirty hack, but it might do what you want: > > https://github.com/macdice/pgdata_mincore > > Tested on FreeBSD, not sure how well it'll travel. You can use pgfincore extension for that purpose, and more. https://github.com/klando/pgfincore/blob/master/README.md -- Cédric Villemain +33 (0)6 20 30 22 52 http://2ndQuadrant.fr/ PostgreSQL: Support 24x7 - Développement, Expertise et Formation