Search Postgresql Archives

Re: How to speed up product code and subcode match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

Using 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;

reduces run time to 5 minutes.

Andrus.


23.05.2023 17:26 Andrus kirjutas:

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.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux