From: | Jayadevan M <maymala(dot)jayadevan(at)gmail(dot)com> |
---|---|
To: | Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Advice - indexing on varchar fields where only last x characters known |
Date: | 2013-10-17 11:35:31 |
Message-ID: | CAFS1N4gBkLox1rZU86XRx4rjO9jywBWGyum=3_4JDfrJZGUe-w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi,
PostgreSQL does have the ability to index on expressions. Will that help?
http://www.postgresql.org/docs/9.1/static/indexes-expressional.html
I think mentioning the version of PostgreSQL you are using, sample
queries/plans etc will help.
Jayadevan
On Thu, Oct 17, 2013 at 4:50 PM, Gary Stainburn <
gary(dot)stainburn(at)ringways(dot)co(dot)uk> wrote:
> I have a problem with a field that appears on a number of my tables.
>
> The field is the Vehicle Identification Number. Every vehicle has one and
> it
> uniquely identifies that vehicle.
>
> Traditionally this was a 11 character string but a number of years ago was
> extended to 17 characters by adding a 6 character prefix.
>
>
> 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.
>
> However, it means that every time I'm trying to connect various tables up
> using foreign keys or doing searches I have to make allowences for this
> which
> means I'm using things like substring, like, regex etc. all of which are
> very
> slow.
>
> Can anyone suggest a better / more efficient way of handling these.
>
> Gary
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
From | Date | Subject | |
---|---|---|---|
Next Message | Craig R. Skinner | 2013-10-17 11:45:12 | Re: Advice - indexing on varchar fields where only last x characters known |
Previous Message | Gary Stainburn | 2013-10-17 11:20:44 | Advice - indexing on varchar fields where only last x characters known |