Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0UxJ-0004gQ-IM for pgsql-hackers@arkaria.postgresql.org; Wed, 11 May 2016 14:17:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b0UxJ-0005lb-4J for pgsql-hackers@arkaria.postgresql.org; Wed, 11 May 2016 14:17:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b0UxH-0005kG-Bl for pgsql-hackers@postgresql.org; Wed, 11 May 2016 14:17:39 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0UxA-0000h8-Cp for pgsql-hackers@postgresql.org; Wed, 11 May 2016 14:17:38 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 7322021C8434; Wed, 11 May 2016 17:17:30 +0300 (MSK) Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zpYN5SCvz64s; Wed, 11 May 2016 17:17:28 +0300 (MSK) Received: from [192.168.27.32] (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id E0CBF21C8433; Wed, 11 May 2016 17:17:27 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1462976247; bh=5qYOPgYSrW6ldjclzhqk8BjxdfaZnLFg2eXGxR6Sw/s=; h=Subject:To:References:Cc:From:Date:In-Reply-To; b=hHAGcVfCLZxCbk2AlUYVQiZ4RDZI/KRw6ZVgO44583RdfPbTyv/uhMX2ghCEoV2t4 XF3ChL7cSyJljyTSogdYVF7WSqar3VzpfPHxzOvxaJaFpoSqDzRhk1FlgZP4zQw6G6 giw8tIvv+QxDhJ1CF12vRxdTKDIR03GAHH7LTluw= Subject: Re: asynchronous and vectorized execution To: Robert Haas References: <49D1AF71-15BD-42C2-88FD-5E894EE4C5B8@postgrespro.ru> <5732399A.4050203@postgrespro.ru> Cc: "pgsql-hackers@postgresql.org" From: Konstantin Knizhnik Message-ID: <57333EFE.3@postgrespro.ru> Date: Wed, 11 May 2016 17:17:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.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: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 11.05.2016 17:00, Robert Haas wrote: > On Tue, May 10, 2016 at 3:42 PM, Konstantin Knizhnik > wrote: >> Doesn't this actually mean that we need to have normal job scheduler which >> is given queue of jobs and having some pool of threads will be able to >> orginize efficient execution of queries? Optimizer can build pipeline >> (graph) of tasks, which corresponds to execution plan nodes, i.e. SeqScan, >> Sort, ... Each task is splitted into several jobs which can be concurretly >> scheduled by task dispatcher. So you will not have blocked worker waiting >> for something and all system resources will be utilized. Such approach with >> dispatcher allows to implement quotas, priorities,... Also dispatches can >> care about NUMA and cache optimizations which is especially critical on >> modern architectures. One more reference: >> http://db.in.tum.de/~leis/papers/morsels.pdf > I read this as a proposal to redesign the entire optimizer and > executor to use some new kind of plan. That's not a project I'm > willing to entertain; it is hard to imagine we could do it in a > reasonable period of time without introducing bugs and performance > regressions. I think there is a great deal of performance benefit > that we can get by changing things incrementally. > Yes, I agree with you that complete rewriting of optimizer is huge project with unpredictable influence on performance of some queries. Changing things incrementally is good approach, but only if we are moving in right direction. I still not sure that introduction of async. operations is step in right direction. Async.ops are used to significantly complicate code (since you have to maintain state yourself). It will be bad if implementation of each node has to deal with async state itself in its own manner. My suggestion is to try to provide some generic mechanism for managing state transition and have some scheduler which controls this process. It should not be responsibility of node implementation to organize asynchronous/parallel execution. Instead of this it should just produce set of jobs which execution should be controlled by scheduler. First implementation of scheduler can be quite simple. But later in can become more clever: try to bind data to processors and do many other optimizations. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers