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 1sz9NM-004TME-01 for pgsql-general@arkaria.postgresql.org; Fri, 11 Oct 2024 06:43:48 +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 1sz9NK-00FMkJ-96 for pgsql-general@arkaria.postgresql.org; Fri, 11 Oct 2024 06:43:46 +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 1sz9NJ-00FMkB-Ta for pgsql-general@lists.postgresql.org; Fri, 11 Oct 2024 06:43:46 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sz9NH-000KCU-Fo for pgsql-general@lists.postgresql.org; Fri, 11 Oct 2024 06:43:44 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a99415adecaso144126366b.0 for ; Thu, 10 Oct 2024 23:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=cybertec.at; t=1728629021; x=1729233821; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ibkdy6nFqLnnlBwfpMXRFRBE7vllD+MzyLpGc2R/auk=; b=AdUaDNBXHBoJO0jGrSLzyn7P32mT9pc84pK7gZC4cexpMdGoluHuLiu2Vl3Pin61Fh 8Cehc7lMTxALxWX6uNxadrhD+pDFIu+8IrXzwlDrQsyQEV0mTfID96/Q8wPFMYAWr1k6 gFL+kwfkUQJbw/lpT6/UdaHh3jXteNUG2j+/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728629021; x=1729233821; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ibkdy6nFqLnnlBwfpMXRFRBE7vllD+MzyLpGc2R/auk=; b=EzzmJwbPLL+23UWW/idgdEmMZ+qdfC25lNAsyQx05QMO6duurMh6bpMKqUIK809l4d iXKP2BhKE67aF4Kx7YtbT6PoY+jNxOFXLrgxCh9SV179NfH5jy8366Np/6QWOmhT6PEU XQAuuCMbQPtwrR/UvJp6L11n/78+Jr/psEy6C4jDJbwSFJhf5NvOVWf5kljMIdxSXNB4 mIgOmwDEuQpsIxlqg6+fvIl1An4bTFSd0zQ62arsYMWuga/TqEZWZaRKxdTJ0kbOx2D3 3xKC7y1PniM5gjJNM9nGSBc95USsOxNhxV4DUAVxXT3LD1ead05qR0xAHbzF9UoR5Uio v+qQ== X-Forwarded-Encrypted: i=1; AJvYcCXEHixBRZEOsV3LFn15gGoS5bNG+rJtUVJahBZc1cD8Xr9V26PnPL7amgRfj6vjQ/Bm8ZDhGqA0bnrI/ikq@lists.postgresql.org X-Gm-Message-State: AOJu0YyLDAKqh7WjFheXQC2jB8KSaBtKQ5CxMA5XKN+bkHghzLERd2pg 32d6v9mwE2RdBUg8tcgDNk3KcpIivERhZidi/8kPCXEm3gTNQbG0QvPLnTR2vGd1nG4uw65iivR H X-Google-Smtp-Source: AGHT+IE2dhC88bdHKkd1/KbSqWjYmVppUerwjFXwuuRf1hEDVi0NKXhLYdh5pZrPhzRW3MARZy/j7Q== X-Received: by 2002:a17:907:1c1f:b0:a99:5364:210c with SMTP id a640c23a62f3a-a99a13ae748mr575102166b.25.1728629021070; Thu, 10 Oct 2024 23:43:41 -0700 (PDT) Received: from dynamic-pd01.res.v6.highway.a1.net ([2001:871:5e:cee2:5de8:9778:e8b6:6357]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99a7f27ea8sm175711166b.82.2024.10.10.23.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 23:43:40 -0700 (PDT) Message-ID: Subject: Re: Question on indexes From: Laurenz Albe To: sud , pgsql-general Date: Fri, 11 Oct 2024 08:43:37 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.4 (3.52.4-1.fc40) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2024-10-11 at 00:19 +0530, sud wrote: > I have never used any 'hash index' but saw documents in the past suggesti= ng issues > around hash index , like WAL doesnt generate for "hash index" which means= we can't > get the hash index back after crash also they are not applied to replicas= etc. > And also these indexes can not be used for range queries , for sorting et= c. >=20 > However, we are seeing that one of the databases has multiple hash indexe= s created. > So I wanted to understand from experts here, if it's advisable in any spe= cific > scenarios over B-tre despite such downsides? > Note- Its version 15.4 database. It is safe to use them, but in my tests I didn't find a realistic case wher= e the were better than a B-tree index: https://www.cybertec-postgresql.com/en/postgresql-hash-index-performance/ Keep them if they do the trick for you, but I'd use B-tree indexes instead. Yours, Laurenz Albe