agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Gavin Flower <GavinFlower@archidevsys.co.nz>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Gary Stainburn <gary.stainburn@ringways.co.uk>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Advice - indexing on varchar fields where only last x characters known
Date: Fri, 18 Oct 2013 07:43:06 +1300
Message-ID: <52602FBA.50303@archidevsys.co.nz> (raw)
In-Reply-To: <20131017183902.GA4943@eldon.alvh.no-ip.org>
References: <201310171220.44550.gary.stainburn@ringways.co.uk>
	<20131017183902.GA4943@eldon.alvh.no-ip.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

On 18/10/13 07:39, Alvaro Herrera wrote:
> 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.
>>
>> On top of this, my users are used to only having to type the last 6 characters
>> for speed and usability reasons.
> Try creating an index on reverse(vin) and using the same function in
> queries; you can put a % at the end of the sought-for literal to match
> suffixes.  That works quite well and is very simple to implement.
>
That is extremely cunning,
and obvious in retrospect! :-)


Cheers,
Gavin


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (11+ messages)  latest in thread

Message-ID: <52602FBA.50303@archidevsys.co.nz>
Permalink:  ../52602FBA.50303@archidevsys.co.nz/
Also on:    postgresql.org/message-id/52602FBA.50303@archidevsys.co.nz

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: GavinFlower@archidevsys.co.nz, alvherre@2ndquadrant.com, gary.stainburn@ringways.co.uk
  Subject: Re: Advice - indexing on varchar fields where only last x characters known
  In-Reply-To: <52602FBA.50303@archidevsys.co.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox