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 1tq9v1-000McY-UG for pgsql-general@arkaria.postgresql.org; Thu, 06 Mar 2025 12:01:40 +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 1tq9v0-00945Q-E8 for pgsql-general@arkaria.postgresql.org; Thu, 06 Mar 2025 12:01:38 +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 1tq9v0-00945E-2E for pgsql-general@lists.postgresql.org; Thu, 06 Mar 2025 12:01:38 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tq9uv-001I0z-2x for pgsql-general@lists.postgresql.org; Thu, 06 Mar 2025 12:01:37 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-ac1f5157c90so94041666b.0 for ; Thu, 06 Mar 2025 04:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1741262494; x=1741867294; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=UYexbweCmcRwUgeIuZbPXHgGoYGsS3TNYrlEAxwiKn8=; b=r8cdlxoqX5Ki3RsIMms5CcnOf1G0hsIh46PvktCfheOK3pK9LVnXRGMvZzkyxcvrar UZUmbAbc6GEMVz+7LiQPMvxctVSpbqumnPUNXn9afm13iflzXd5pssk/yPM8GddxN7nj IkbKnaV7OdK5KvlpFzN/94gEUzDJFqV8Vjbp48MoOiEs9FHBSW+FsAuomBeF4pmQTKf+ Np2vtKl6r6YMAHzSfiY32zOm+hHYYeEREoCP4VWG9s/2G/bsdV5cHVB9et8tkQkcGOmD M2JF3QYiYb0ZIC4Uvni6eWcTFMNU/Sza/rN/EOZg5RsG5ebeyJKq1hf+jUZgRKv2+WN/ A+sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741262494; x=1741867294; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UYexbweCmcRwUgeIuZbPXHgGoYGsS3TNYrlEAxwiKn8=; b=UmeVAmP8cal3fhSKLNHRa8XSa5AiZnvbPImLAQI0prv3yhIw027w33rinRhyT+q4He ZeSHJl/ybqxXqFCpuSlZa+FvK3pqDBWU29/euMDMPvwqJmVddXCa7/KtIo+u99N6WX9V pPh1xU88mO4IUx/HwlkpnAbrS0l0k6Dfc1EUAzfo8xzYXrNAV2mwANyK7CM4s+rsG3rb bJqa/hu4vqX506fbSUSmuM6bNSfEs7zuZsFOhfLBkJCdmLH9bPjwVg2G/M4rbv1v9Zgs 2+Cf/OYxdyRYVwEn41dG1/lugLyqmtS6Cu6IPCOQ11Y6zZkxGLBIreKKVELEE28qJAT6 A54w== X-Forwarded-Encrypted: i=1; AJvYcCXl6MBoy8l+TQT/6Ludu9TkppbS71397UegbdY25ZTM+j4JjssBb0RMyqapuB5obcf+JmsPWDB8FqM64aNu@lists.postgresql.org X-Gm-Message-State: AOJu0YzQ9H1LV3Q6o9LIDaY9k9VYzwYUqYpEQKqTpEP5q6zKlx7X/ORB hhawGPvUEHr1lHi60weYJH7LrL/L7H/8xGrIZ3oh38FlZa+hU35YRW97ptJhqSwxCLR8wkHLBfn S X-Gm-Gg: ASbGncuPZnmwOQbaus3YQBY4PzqKslePuUsM5n+LM13FXtrZ10Y9cj+oVr7TXOdGpOy zWUmng/f2aNKBUSY4DZImjouS6LKPTV3hzyBDfacqKLppPSvoAU4nPUX2umk7pY4uesQmFeMtba 2XB4tYfjYsjKEFaKL2D79za30RSQIr+ZvWErcL02aoAVKO0HwcU7DDMPEMR9VjlA9y0zT/Tsqpx lQGMY2/7JBeBin10VydkH4zxoExIjTsh8husacxI2udsBG6Ou6N6JkBV/mTKDbmo4ad77XrAvWw wxPhoCZE0ty0C/4aTWcuMEmw9aqZC2JAhqyohzlsoSRPSuPrIavvz27IgCpwOQ== X-Google-Smtp-Source: AGHT+IF0+9+6sdmWDfCgPIDHMtm9o/0uCXmKaquawHeaOne4KRim4Xvv46mUde75nAyB5r0mQwnEMA== X-Received: by 2002:a17:907:6e92:b0:ac1:f759:f9e7 with SMTP id a640c23a62f3a-ac20da187b5mr564273466b.23.1741262493833; Thu, 06 Mar 2025 04:01:33 -0800 (PST) Received: from localhost.localdomain ([2001:871:5e:b59d:48a2:d9:55d2:155c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ac239481685sm87173666b.58.2025.03.06.04.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Mar 2025 04:01:33 -0800 (PST) Message-ID: <0a6ee022deb198be152670742e20eae4099ae9ec.camel@cybertec.at> Subject: Re: Quesion about querying distributed databases From: Laurenz Albe To: me nefcanto Cc: Adrian Klaver , pgsql-general@lists.postgresql.org Date: Thu, 06 Mar 2025 13:01:32 +0100 In-Reply-To: References: <099b49ebae94e23f19afdad3f8c9c6e702a3a2d5.camel@cybertec.at> <6d7e1022-6404-4dab-8467-8d1f6e8b63cb@aklaver.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-03-06 at 12:15 +0330, me nefcanto wrote: > We had problems with cross-server queries on SQL Server and MariaDB too. > It seems that cross-server queries are not solved by any engine. But we > had no problem with cross-database queries. That's where it worked well > both on SQL Server and MariaDB. But then you always worked with a monolithic system. Splitting over severa= l "databases" (we call them schemas) does not allow you to scale horizontally= . > > Well, if you split the data into several databases, that *was* sharding= . >=20 > The way I understood it, sharding is when you split the database by rows, > not by tables. Examples choose a column like Tenant or User or Date as th= e > base of sharding. Never have I seen an example that stores Orders on one > database and Customers on another database and call it sharding. Right. And I don't think that your data model is good. It won't scale well, because you don't get more tables as you get more data. > But to choose a technology, we do have enough literacy and experience. > It's just some simple questions and answers. If I know that FDW works > differently for same-server databases, then I know that we will migrate. It doesn't work any differently. > > Don't ever store arrays in the database.=C2=A0 It will be a nightmare. >=20 > This is a very interesting claim. May I ask you to share its problems > and your experience? If you store foreign keys in arrays, you have no referential integrity, and any join over the array will be complicated and slow. If you store many values in an array and you want to update one of these values, you have to retrieve the whole array, construct a new array and store that. You cannot modify individual array elements, only the whole thing. Of course there are ways to use arrays that are not harmful. It's just that almost always when I see someone use an array as table column, it is an abuse of technology. Yours, Laurenz Albe