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 1syzuB-003ZGF-Of for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2024 20:37:05 +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 1syzuB-00739N-0P for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2024 20:37:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1syzuA-00737X-Jb for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2024 20:37:03 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1syzu7-000Fyt-9J for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2024 20:37:01 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4XPhPb4xH2z9sWN; Thu, 10 Oct 2024 22:36:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1728592611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xHw5aYezXmhKpcZhIt6CS4KnwwAm49An0Kk80N9PvxY=; b=F3RZkKtjAAHETfLt90YEPpWaquUwsB4pN+x56oAgDxULBYBhV/zzMGNyWRb5jGNOy51Gai 6xRvSFhaWgH8mU5Y9RJEkT4Q22s0hlFdIbdT20UiVOwwFzbxsAFx6soHRgal2L+uN+cKvJ FNZvAkl/aS89NykQu8UNl/VOxtT/40gbV7J5UGwAQVXKttv9WwdvJiss4DhY2+X/7IFJjy rK1hr7JdBKhb22Mc0XELoH/DH+5T/DoqZzj4WyLI0DFUiauCtAHFLUTyRmfgUSHtrMjbTk tggkNHmcFllKzftiUgxgwmyxjVu/axUhY02zexMmZWmqxM6FLlSFnfEjJCVZnQ== Date: Thu, 10 Oct 2024 22:36:47 +0200 From: Erik Wienhold To: sud Cc: xof@thebuild.com, pgsql-general Subject: Re: Question on indexes Message-ID: References: <88e5c335-c70e-4973-9b71-6c12e251e5b7@ewie.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-10-10 21:44 +0200, sud wrote: > Not yet confirmed, but actually somehow we see the DB crashed repetitively > a few times and teammates suspecting the cause while it tried extending > this hash index. Your first mail says that you're using version 15.4. You should consider upgrading to 15.8 to get the latest bugfixes. > Did you experience any such thing with hash index? No. But I can't remember ever seeing a hash index in the databases that I've worked on. > However, as you mentioned ,if we have any column with large string/text > values and we want it to be indexed then there is no choice but to go for a > hash index. Please correct me if I'm wrong. Define "large". What kind of text (natural, JSON, XML, base64, DNA sequences, etc.) is stored in those columns? Why do you want/need to index those columns? Because hash indexes only support the equal operator, one can only use that index to search for exact matches (i.e. values with identical hash code) which I find strange for values that are so large that btree cannot be used. But maybe you have solid use case for that. If it's natural text and you're using tsvector for full-text search, then GiST or GIN indexes are a better choice: https://www.postgresql.org/docs/current/textsearch-indexes.html -- Erik