Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g9Eb5-0001LH-Kw for pgsql-general@arkaria.postgresql.org; Sun, 07 Oct 2018 19:20:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g9Eb0-0007oE-S9 for pgsql-general@arkaria.postgresql.org; Sun, 07 Oct 2018 19:20:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g9Eb0-0007o6-FH for pgsql-general@lists.postgresql.org; Sun, 07 Oct 2018 19:20:06 +0000 Received: from ec2-34-255-138-49.eu-west-1.compute.amazonaws.com ([34.255.138.49] helo=zimbabwe.chezphil.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g9Eax-0000QT-VK for pgsql-general@lists.postgresql.org; Sun, 07 Oct 2018 19:20:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=chezphil.org mappendix.com; s=20171026; h=Content-Type:MIME-Version: Message-ID:Subject:Date:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PgwojftXetO+dMMylhhRcg0vYJ08dERvNh5314118I8=; b=FOkfePfvKfKHth9uludMM07S5 eJBp2pubn0EBeme2h5kyWVEEwlA+zSPcmVy768CoUxW7eykVuC4g4rKkd0PhnW5aTJjiNBKmPmP9m +DZ0d8pDhkwNXBJH+Qt+YUo7UZ/vbiRdIoU7FYwKfnebgLMcxGvp6XmUQfFL5Aes4V6Fc=; Received: from localhost ([127.0.0.1] helo=chezphil.org) by zimbabwe.chezphil.org with esmtp (Exim 4.89) (envelope-from ) id 1g9EYp-0002sg-Py for pgsql-general@lists.postgresql.org; Sun, 07 Oct 2018 20:17:51 +0100 Received: from localhost ([::ffff:127.0.0.1]) by zimbabwe with smtp (dmsmtpd 0.00001); Sun, 07 Oct 2018 20:17:51 +0100 From: "Phil Endecott" To: "ROS Didier" , Date: Sun, 07 Oct 2018 20:17:51 +0100 Subject: RE: Why the index is not used ? Message-ID: <1538939871586@dmwebmail.dmwebmail.chezphil.org> X-Mailer: Decimail Webmail 3alpha16 MIME-Version: 1.0 Content-Type: text/plain; format="flowed"; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Didier, Your email is didier.ros@edf.fr. Are you working at Electricite de France, and storing actual customers' credit card details? How many millions of them? Note that this mailing list is public; people looking for targets with poor security from which they can harvest credit card numbers might be reading it. And after you are hacked and all your customers' credit card details are made public, someone will find this thread. > it's not the best solution, but we have data encryption needs and good > performance needs too. I do not know how to do it except the specified > procedure.. You should probably employ someone who knows what they are doing. Sorry for being so direct, but really... storing large quantities of credit card details is the text book example of something that has to be done correctly. > if anyone has any proposals to put this in place, I'm interested. Why do you need to search by credit card number? If you really really need to do that, then one option is to use an encryption function that doesn't salt the data. Or you could store part of the number (last 4 digits?), or an unsalted hash of the number, unencrypted and indexed, and then you need only to sequentially decrypt (using the salted encryption) e.g. 1/10000 of the card numbers. But there are complex security issues and tradeoffs involved here. You probably need to comply with regulations (e.g. "PCI standards") which will specify what is allowed and what isn't. And if you didn't already know that, you shouldn't be doing this. Good luck, I suppose. Phil. P.S. It seems that you were asking about this a year ago, and got the same answers...