Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VWm1F-00063o-2c for pgsql-sql@arkaria.postgresql.org; Thu, 17 Oct 2013 11:45:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VWm1E-0005oI-Ar for pgsql-sql@arkaria.postgresql.org; Thu, 17 Oct 2013 11:45:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VWm1D-0005oB-Cj for pgsql-sql@postgresql.org; Thu, 17 Oct 2013 11:45:31 +0000 Received: from teak.britvault.co.uk ([78.33.153.148]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VWm0w-0004YD-P6 for pgsql-sql@postgresql.org; Thu, 17 Oct 2013 11:45:31 +0000 Received: by teak.britvault.co.uk (Postfix, from userid 1970) id 3d0pTN2y9VzBBW; Thu, 17 Oct 2013 12:45:12 +0100 (BST) Date: Thu, 17 Oct 2013 12:45:12 +0100 To: pgsql-sql@postgresql.org Subject: Re: Advice - indexing on varchar fields where only last x characters known Message-ID: <20131017114512.GA24563@teak.britvault.co.uk> References: <201310171220.44550.gary.stainburn@ringways.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201310171220.44550.gary.stainburn@ringways.co.uk> User-Agent: Mutt/1.5.21 (2010-09-15) From: skinner@britvault.co.uk (Craig R. Skinner) X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 2013-10-17 Thu 12:20 PM |, Gary Stainburn wrote: > > The problem that I have is that these VIN numbers are provided by a number of > data systems including manufacturer feeds, logistics companies as well as > internal systems. Some use the full 17 character string while others only use > the last 11. > Split the vin into 2/3 columns? vin_prefix (NULL), vin_suffix (NOT NULL) vin_prefix, vin_centre, vin_suffix UNIQUE all together in 1 constraint & index each separately. Maybe... -- Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql