Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aXFQQ-000385-Fb for pgsql-performance@arkaria.postgresql.org; Sat, 20 Feb 2016 21:50:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aXFQQ-0005fg-1X for pgsql-performance@arkaria.postgresql.org; Sat, 20 Feb 2016 21:50:50 +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.84) (envelope-from ) id 1aXFQO-0005ex-R5 for pgsql-performance@postgresql.org; Sat, 20 Feb 2016 21:50:49 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aXFQL-0000pa-50 for pgsql-performance@postgresql.org; Sat, 20 Feb 2016 21:50:47 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7F716205A5 for ; Sat, 20 Feb 2016 16:50:43 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Sat, 20 Feb 2016 16:50:43 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=FSBn6o8Yj5oVVChPC3Bb7qYtxw0=; b=fTAmRF 6V0sYOC4KV7rdJb056Rirlryc8dr3uZpk+eG19zC2Xi8H+s1ApOApER8F5Jsd66v lqmle+On51uwWt51WLFmAVK4e0HzXKYpWiOUCqH8ReqCQTjr7zIAZOy3pxUj6v60 WyUUTpPVyMWSktW+9rElS3ABNbp3X/AWhrseo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=FSBn6o8Yj5oVVCh PC3Bb7qYtxw0=; b=Ans+4RrBQFh8c3yjaq4if8nITYjF3zq6ztKQxDu4C1NDE6V XuygnBrDwRap0THA41bnm3KCnQrvw0XB4p8YFY55C9CFVrA3A7UpqD2AM8zz7NJU QzY4aqL6v2TtB8Nz74chFUniwdh6kDJZofTRbcMYMJhTNZ8nDtv2GtT2RLCc= X-Sasl-enc: /Tm9gE6F4LGfPAjBWLLpbeMYS8ANGUl+C7Z+Ytv59AnQ 1456005043 Received: from [192.168.1.2] (174-21-70-246.tukw.qwest.net [174.21.70.246]) by mail.messagingengine.com (Postfix) with ESMTPA id C5A1C680110; Sat, 20 Feb 2016 16:50:42 -0500 (EST) Subject: Re: [GENERAL] Why Postgres use a little memory on Windows. To: Francisco Olarte References: <56C8ACBE.60004@aklaver.com> Cc: tuanhoanganh , PostgreSQL , pgsql-performance From: Adrian Klaver Message-ID: <56C8DF6B.7050101@aklaver.com> Date: Sat, 20 Feb 2016 13:49:31 -0800 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 02/20/2016 10:39 AM, Francisco Olarte wrote: > On Sat, Feb 20, 2016 at 7:13 PM, Adrian Klaver > wrote: > ..... >> FROM >> sym_data d INNER JOIN sym_data_gap g ON g.status = 'GP' >> AND d.data_id BETWEEN g.start_id >> AND g.end_id > ..... >> The thing that stands out to me is that I do not see that sym_data and >> sym_data_gp are actually joined on anything. > > Yes they are, although the formatting hid it somehow. > > It is a classic, data_gap defines intervals via start+end id over > data, he wants to join every data with the corresponding gap. It is a > hard optimization problem without knowing more of the data > distributions, maybe the interval types and ginindexes can help him. > When faced with this kind of structure, depending on the data > distribution, I've solved it via two paralell queries ( gap sorted by > start plus end, data sorted by id, sweep them in paralell joining by > code, typical tape-update problem, works like a charm for > non-overlapping ranges and even for some overlapping ones with a > couple of queues ) . And he seems to want all of the data ( sometime > this goes faster if you can add a couple of range conditions for > data.id / gap.start/end_id. Thanks to you and Tom for enlightening me. I am going to have to spend some time puzzling this out to convert what you have shown into something that I can wrap my head around. > >> Also is it possible to see the schema definitions for the two tables? > > My bet is on somethink like data.id ~serial primary key, > gap.start/end_id foreign key to that. > > Francisco Olarte. > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance