Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdZV0-006I8P-1u for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Feb 2024 17:38:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rdZUx-002RhS-A2 for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Feb 2024 17:38:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rdZUw-002RhK-Vo for pgsql-hackers@lists.postgresql.org; Fri, 23 Feb 2024 17:38:11 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rdZUp-000YVP-JL for pgsql-hackers@postgresql.org; Fri, 23 Feb 2024 17:38:10 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-512e01b3da3so1450533e87.3 for ; Fri, 23 Feb 2024 09:38:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1708709882; x=1709314682; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oWsUs0zrGWMmm1rpDBoZxeIwHb3xA89JSVBb0pS8JuY=; b=LVh/gHfdxVarMUhlzkwPiBaoY5rQUPB9SwAduI86+KRBVu53PydAz/XAmLRkoro9GG xzBwzjhil9mgD9s+v7cTd3s6mmSAbZ3SEia17luOUrkjGckwGZQHqwrHYIWEu8+I/e+W 6UZBsJW58Ep5/mFxW9ZHqmQmTYd/VeVGZrJglLH0k9ToE5J4sXsRXKsgVlYHWXPaygl8 2NQ+qUYFI76RY2BvT9c/ET5w1zbXn/z6AfauYmKV7AT7qwFtt4MUHSHeUxa+J5UKHT9N ZBppuIImqF83JMtf4v9/DjYwz6G5A6akVJtGbwY32fPAN0YCEPkMY8O3PTP/TJYL7BvS G7dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708709882; x=1709314682; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oWsUs0zrGWMmm1rpDBoZxeIwHb3xA89JSVBb0pS8JuY=; b=i4ftARvrq04kaP4UupX6GYHKVYBPUvM/PEZQnPWGdWBeh0OcNQf8VQQPRWX6/DuX/z fbdQd7O+lJPUuzoNq5V5U8KUL01afCvT7nf15WlPg31yS/+jLhmZ3e/lGboETnzVeDO+ CEzAeprZIqPJyOqpZA2Q9pFrZpHEbsrJQCjq9kyge0R+CRq6IJQAkDKklJR0SbRLkEyZ 9BymIIPmbBwVz1KH4F4GgUp+yencoG95++5IBEH86RLE9ZprAJbaSsxK3e5ya1BAhueh pPFMeU7FzHUONtdEcGSW6ATbiYthAjpapNMWsRW4N4deu6K8JBxQLx7DNJzaBk6zmLq9 TRXQ== X-Gm-Message-State: AOJu0YyDl4GpBS59u6gnOW2PuBO7mG/tMEW8mebAe+uidE+Cera1DaRJ yDoVEevAZYqrHnL1o1j1q/MDwTmBRflQ7bP8dNgo2XP4U/E3ZoX3ZcOoL0hnXiqU0iq0v9aizj8 = X-Google-Smtp-Source: AGHT+IEoAUxliCwRIyYuWUxbomNBFrRY70zRXn9GnWaalKz7jWprtOqjK5Td0hJUgc9h8A0qZHCJQQ== X-Received: by 2002:ac2:5fd0:0:b0:512:c985:4890 with SMTP id q16-20020ac25fd0000000b00512c9854890mr275145lfg.67.1708709882121; Fri, 23 Feb 2024 09:38:02 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-229-30.bb.vodafone.cz. [86.49.229.30]) by smtp.gmail.com with ESMTPSA id fw14-20020a170906c94e00b00a3f04112c0csm3591311ejb.221.2024.02.23.09.38.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Feb 2024 09:38:01 -0800 (PST) Message-ID: <5fa7f8a7-ce94-4a2a-ab93-4d43f97a1a41@enterprisedb.com> Date: Fri, 23 Feb 2024 18:37:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL Property Graph Queries (SQL/PGQ) Content-Language: en-US To: Peter Eisentraut , Andres Freund Cc: pgsql-hackers References: <20240216192301.q2tf4bqjydymg3g2@awork3.anarazel.de> <9c5edd61-c415-475b-a088-7bd7461b21a4@eisentraut.org> From: Tomas Vondra In-Reply-To: <9c5edd61-c415-475b-a088-7bd7461b21a4@eisentraut.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/23/24 17:15, Peter Eisentraut wrote: > On 16.02.24 20:23, Andres Freund wrote: >> One aspect that I m concerned with structurally is that the >> transformation, >> from property graph queries to something postgres understands, is done >> via the >> rewrite system. I doubt that that is a good idea. For one it bars the >> planner >> from making plans that benefit from the graph query formulation. But more >> importantly, we IMO should reduce usage of the rewrite system, not >> increase >> it. > > PGQ is meant to be implemented like that, like views expanding to joins > and unions.  This is what I have gathered during the specification > process, and from other implementations, and from academics.  There are > certainly other ways to combine relational and graph database stuff, > like with native graph storage and specialized execution support, but > this is not that, and to some extent PGQ was created to supplant those > other approaches. > I understand PGQ was meant to be implemented as a bit of a "syntactic sugar" on top of relations, instead of inventing some completely new ways to store/query graph data. But does that really mean it needs to be translated to relations this early / in rewriter? I haven't thought about it very deeply, but won't that discard useful information about semantics of the query, which might be useful when planning/executing the query? I've somehow imagined we'd be able to invent some new index types, or utilize some other type of auxiliary structure, maybe some special executor node, but it seems harder without this extra info ... > Many people will agree that the rewriter is sort of weird and archaic at > this point.  But I'm not aware of any plans or proposals to do anything > about it.  As long as the view expansion takes place there, it makes > sense to align with that.  For example, all the view security stuff > (privileges, security barriers, etc.) will eventually need to be > considered, and it would make sense to do that in a consistent way.  So > for now, I'm working with what we have, but let's see where it goes. > > (Note to self: Check that graph inside view inside graph inside view ... > works.) > AFAIK the "policy" regarding rewriter was that we don't want to use it for user stuff (e.g. people using it for partitioning), but I'm not sure about internal stuff. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company