pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Bzm@g <bzm@2bz.de>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to speed up product code and subcode match
Date: Tue, 23 May 2023 17:26:12 +0300
Message-ID: <21737d42-c902-92f1-2f95-8013abca1531@hot.ee> (raw)
In-Reply-To: <908933.1684850425@sss.pgh.pa.us>
References: <7181fbab-1b51-c005-2576-d287fbcd784c@hot.ee>
	<908933.1684850425@sss.pgh.pa.us>

Hi!

> Separate
> the product code and size into two columns --- if there's somebody
> who really wants to see them in the above format, give them a
> view or generated column.  Then instead of the impossible-to-optimize
> queries you showed, you could do something like
>
> select toode.toode , n2, n3, n4
> from toode, vordlusajuhinnak
> where toode.toode = vordlusajuhinnak.toode;
>
Can function index

create index on toode ( *split_part( toode, '/',1) *)

and query

select toode.toode , n2, n3, n4

from toode, vordlusajuhinnak

where *split_part( toode.toode, '/',1) *= vordlusajuhinnak.toode;


used and keeping existing table structure? Functional index should 
produce same speed improvement as using separate column?

Andrus.

view thread (5+ messages)  latest in thread

Message-ID: <21737d42-c902-92f1-2f95-8013abca1531@hot.ee>
Permalink:  ../21737d42-c902-92f1-2f95-8013abca1531@hot.ee/
Also on:    postgresql.org/message-id/21737d42-c902-92f1-2f95-8013abca1531@hot.ee

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: kobruleht2@hot.ee, tgl@sss.pgh.pa.us, bzm@2bz.de
  Subject: Re: How to speed up product code and subcode match
  In-Reply-To: <21737d42-c902-92f1-2f95-8013abca1531@hot.ee>
  References: <7181fbab-1b51-c005-2576-d287fbcd784c@hot.ee> <908933.1684850425@sss.pgh.pa.us> <21737d42-c902-92f1-2f95-8013abca1531@hot.ee>

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

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