Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUfhu-0006II-9I for pgsql-performance@arkaria.postgresql.org; Sat, 25 May 2019 23:04:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hUfht-0007fI-06 for pgsql-performance@arkaria.postgresql.org; Sat, 25 May 2019 23:04:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUfez-0002zl-1K for pgsql-performance@lists.postgresql.org; Sat, 25 May 2019 23:01:05 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hUfes-00005t-1x for pgsql-performance@lists.postgresql.org; Sat, 25 May 2019 23:01:03 +0000 Received: by mail-wm1-x32e.google.com with SMTP id z23so8308549wma.4 for ; Sat, 25 May 2019 16:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Pbw6c0zXyQCmJMD1BftBDYYW+jif63BW+FJVrzt8oMo=; b=N+Ju4w35micmVIQpEg7A2NLu34SVKdeulKy2QpYv669LMHUNzwpCgVrmtH+4joVSgY b50rj1UMvro9B3wHqYeTJ/aMy1pTzc9wutqtowWK87ytuk4pMbpklEG6GMcufxSjJVxq z5LjpSxU0F+8F6O4+ndX5MbHfSxc9VlVS1O6062YrHxAeUM1JcRZ1MdB6+b/P5qhExyk ITd4gs7xYcW5+E6geKd6hmscq5QX3wIYW4gtGjT+T/ZizUsHroFFr5gxq1x5x1Rlwz/F +3zmT1AW3dYNw2DMISSEMWXTqDnr9+TDanPZ0DLGdW5fbZ0vPWYuQjFY/0GgUnLXcUT9 3JEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Pbw6c0zXyQCmJMD1BftBDYYW+jif63BW+FJVrzt8oMo=; b=WOBD6zahaXt9u6onX1bRIwrAsMRF0av+tmd85HUuFE3RLHcm0GE9x4njt24N3TCQeJ Nt8cl07eGJox5Vgq5VUzi/lP+ZLPLwwjvHGG5Csa7SpoMdEMIH+DWps4wQJxSq6BxIvl EwE9klCmP7yiCEpAqGx6Vl2R+ibkJHniL5CctaJzBbPtZbUehxLrSYZjpP04hK2tNQjO gHmr3+eDEZQYk33tWhnjAjp2oEK7a+j917LJiCC0Q++utFE4qV8Lpg1p2vyCqnOibt5r ns9h6L6IUD6wx2EzfqGmB1P/rQEcSSI+S5Cw3j28N1U2wX/9aLC0v+daSIwjP2K6QrFl g6iQ== X-Gm-Message-State: APjAAAUTofchlto7kQrZrOioZR9rNlFHMS0UsGXjh4k5a+UR7Ww2YbwL NQ7ewHwDGZF7uNww7viALgj2p7pe X-Google-Smtp-Source: APXvYqxx+6YDJI+1HEIsbVVJRRm6KZ3s2VdmGeQPrFIwMQx2QvpCKLBK/3V4YBPZ/WylSjMdiUqKoQ== X-Received: by 2002:a1c:a00a:: with SMTP id j10mr4559565wme.41.1558825256197; Sat, 25 May 2019 16:00:56 -0700 (PDT) Received: from [192.168.66.78] (pD958215A.dip0.t-ipconnect.de. [217.88.33.90]) by smtp.googlemail.com with ESMTPSA id y10sm14389105wmg.8.2019.05.25.16.00.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 May 2019 16:00:55 -0700 (PDT) Subject: Re: UUID v1 optimizations... To: pgsql-performance@lists.postgresql.org References: <8d5f4b67-d540-8d3d-9979-808b9c1e1ca7@googlemail.com> <20635.1558796270@sss.pgh.pa.us> <19faa3aa-a103-b991-ff20-b73852085f30@googlemail.com> <14074.1558821255@sss.pgh.pa.us> From: Ancoron Luciferis Openpgp: preference=signencrypt Autocrypt: addr=ancoron.luciferis@googlemail.com; prefer-encrypt=mutual; keydata= mQINBE3Z7bUBEAC3ZYDTnxOiu0JWJR+6XzFQmJEVncGMehyuE9GBfyaNYnsNKmFITkubNVB9 tN/xgn5FJ9eg0WediTaWXigHNDDOPSNHZGaf1nHu0AQNOgpEyJETtX/A56PXQ82+VwoKCNUN v8+m5CJ8njWZlZMCVA3AcQ1vR2VRR6O0pzEVPDCDMutPytkRl+XrPoPhxMTVEmwM4jfWwmfI NgiOZnsueU78VW8Go1qTN20YdVOdVpbPWfyp8VIGYBNjEEefv5f/l+zt4Z+CQMmvunDUdaKY 85opNIMLqC3dDY0AQG+FpcDLhHWLcuGLmE+Ghiix0G3kX4QX/fH0/2KtVNdfnZtcpq+5rim0 E97PVQe4EixVD/DivpwvNMWqQ2GJlOCx52+J13ZSfe/63XpjL7TNqhR3wMnNuMidLMgLoH5z RtQ2FH9zeYlKgqMUkmwvEHVI+M4oQRE0rzgqx6xHbkPIFEov9ZziQVwCtct+Ja9ho/BXoe/T VIFVOGEp7DG12QSaiLILhzTRUkDXqa+BH9H4V2Hsv77nT2JQ7KO9pM5gb4wq4gtLFo7MMTUq jlqjD2vOm3NY3tg1s7HTggVNgGsWhh9JlNR3v9SRGckKVIIvwDxvzo+Z4iji2SLElWb9BWiH Xku5IEuWGTmC+nOzSvbSxTaC53JcppC5kKXj11N73uw5eR4s3wARAQABtDRBbmNvcm9uIEx1 Y2lmZXJpcyA8YW5jb3Jvbi5sdWNpZmVyaXNAZ29vZ2xlbWFpbC5jb20+iQI4BBMBAgAiBQJN 2e21AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXg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+nte9Tt8CTQ== Message-ID: Date: Sun, 26 May 2019 01:00:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <14074.1558821255@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 25/05/2019 23:54, Tom Lane wrote: > Ancoron Luciferis writes: >> On 25/05/2019 16:57, Tom Lane wrote: >>> (4) it in fact *wouldn't* do anything useful, because we'd still have >>> to sort UUIDs in the same order as today, meaning that btree index behavior >>> would remain the same as before. Plus UUID comparison would get a lot >>> more complicated and slower than it is now. > >> I get your first sentence, but not your second. I know that when >> changing the internal byte order we'd have to completed re-compute >> everything on-disk (from table to index data), but why would the sorting >> in the index have to be the same? > > Because we aren't going to change the existing sort order of UUIDs. > We have no idea what applications might be dependent on that. > > As Vitalii correctly pointed out, your beef is not with the physical > storage of UUIDs anyway: you just wish they'd sort differently, since > that is what determines the behavior of a btree index. But we aren't > going to change the sort ordering because that's an even bigger > compatibility break than changing the physical storage; it'd affect > application-visible semantics. > > What you might want to think about is creating a function that maps > UUIDs into an ordering that makes sense to you, and then creating > a unique index over that function instead of the raw UUIDs. That > would give the results you want without having to negotiate with the > rest of the world about whether it's okay to change the semantics > of type uuid. > > regards, tom lane > I understand. Point taken, I really didn't think about someone could depend on an index order of a (pretty random) UUID. The whole point of me starting this discussion was about performance in multiple areas, but INSERT performance was really becoming an issue for us apart from the index bloat, which was way higher than just the 30% at several occasions (including out-of-disk-space in the early days), apart from the fact that the index was regularly dismissed due to it not being in memory. In that sense, just creating additional indexes with functions doesn't really solve the core issues that we had. Not to mention the performance of VACUUM, among other things. So, even we currently "solved" a lot of these issues at the application level, we now have UUID's that look like v1 UUID's but in fact will not be readable (in the representation as returned by PostgreSQL) by any other application that doesn't know our specific implementation. This forces us to hack other tools written in other languages that would otherwise understand and handle regular v1 UUID's as well. I should add that the tests I have made where all running on dedicated SSD's, one for the table data, one for the indexes and one for the WAL. If those where running against the same disks the difference would probably be much higher during writes. I'll think about creating an extension to provide a custom data type instead. So nobody would be at risk and anyone would decide explicitly for it with all consequences. Thank you for your time and precious input. :) Cheers, Ancoron