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 1vAaOz-003XQQ-Rd for pgsql-general@arkaria.postgresql.org; Sun, 19 Oct 2025 20:53:17 +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 1vAaOy-00CX2y-LR for pgsql-general@arkaria.postgresql.org; Sun, 19 Oct 2025 20:53:15 +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 <01020199fe3f6030-5d953b42-e08d-4782-9da3-3d635f5445af-000000@mail.rodonnell.ie>) id 1vAaOy-00CX2p-A8 for pgsql-general@lists.postgresql.org; Sun, 19 Oct 2025 20:53:15 +0000 Received: from a7-34.smtp-out.eu-west-1.amazonses.com ([54.240.7.34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from <01020199fe3f6030-5d953b42-e08d-4782-9da3-3d635f5445af-000000@mail.rodonnell.ie>) id 1vAaOu-0036f1-1N for pgsql-general@postgresql.org; Sun, 19 Oct 2025 20:53:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=pttss7zjfbrazujxl6mrlo4sg34ocala; d=rodonnell.ie; t=1760907190; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=A186qTrzx/lwywU+NzFZcL7s1plr6WU15AdAZ4qbeYw=; b=lEr9FvMdGNTzQOpLJGI8+JfeBhTsvVEaVD26VN4QNtZhGNuwWLDJXeyKMDqzZRag GduTgTF9uUJet8MfxpSUDTJ5TKqRh0x+6CemVieFO5bXYdRuYDWcNZzzl3g5rpBBEJ1 Ca68L+GHvQORY0al+Kp2rLCkhH3C3yxuwSeGIBKTB/99lVGWgeYBqfMrYbEDynuosdi jG76qrTmskAuSomsGDUVxZm3C3ggMncHUuq+406Jhw+JZKZrFNYzph/w0hO8HpOvMQw Bk8CfmORrb02XemxfTB6kx+mxMxtcznvMXMgdTXAzWd38pomxBHOuE/4D37+in0USGa 22f2HuI44g== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1760907190; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=A186qTrzx/lwywU+NzFZcL7s1plr6WU15AdAZ4qbeYw=; b=PD9xLhVzUtp1o0mnusjcnXpgMalOsw+YlST3eWKF5dtc7lnS/dySxKjdqnjXb/+z x8l5nSo2XCjlaaUmKJxd40tYLcCCud31srtTdbRj2E1y2Wh7a336TAyH5BsUFcsXnnf MqTFCchZewLnv+DEfoqbTCVVpoG31/zz9oAVO3zY= Message-ID: <01020199fe3f6030-5d953b42-e08d-4782-9da3-3d635f5445af-000000@eu-west-1.amazonses.com> Date: Sun, 19 Oct 2025 20:53:10 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Arrays vs separate tables To: Rich Shepard , pgsql-general@postgresql.org References: <162e5330-861c-ecc7-45c1-aaa1aff26c88@appl-ecosys.com> Content-Language: en-GB From: Ray O'Donnell In-Reply-To: <162e5330-861c-ecc7-45c1-aaa1aff26c88@appl-ecosys.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Feedback-ID: ::1.eu-west-1.Bw1eu/7Uepg3xcsiFBL71JJRCh2A2yTFrgBhhiulXmU=:AmazonSES X-SES-Outgoing: 2025.10.19-54.240.7.34 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19/10/2025 21:43, Rich Shepard wrote: > In the former book I read that sometimes it's better to have multiple > values > for an atribute in a single row by creating a separate table for that > attribute rather than using the postgres array capability. The people > table > in my database (1706 rows) has two attributes using the array type > (direct_phone and email), and only a few indivuals have multiple landline > phone numbers (cell_phone is a separate column) or email addresses > (office > and personal?). Would it make sense for me to create new landline and > email > address tables and replace the array contents? > My experience of doing something similar was that arrays work very well for the use-case you describe, as long as you don't have to search inside the arrays... I found that, if you have to search for a specific value inside an array, then performance really goes out the window. Mind you, clever use of an index would probably help here. Ray. -- Ray O'Donnell // Galway // Ireland ray@rodonnell.ie