[MariaDB discuss] Re: query optimization

2025-05-06 Thread Jaco Kroon via discuss
Thanks Gordan, I'll look into ProxySQL first, thank you. It's not "no scope", just insanely hard scope due to the entity manager that does the SQL and the code where it is used is separated by several layers. I think you confirmed my option below exceptionally well, thank you.  And now I kn

[MariaDB discuss] Re: query optimization

2025-05-06 Thread Gordan Bobic via discuss
If you have no scope to change the query in the application your options are limited to: 1) Use a materialized view rather than a regular view (static table that contains the output of a view, maintained by triggers) 2) Query rewrite in a proxy you put in front of MariaDB. MySQL has a query-rewrite

[MariaDB discuss] Re: query optimization

2025-05-06 Thread Pantelis Theodosiou via discuss
Why not two separate queries then, and modify the application code to combine the results? SELECT * FROM table WHERE p1 = 'p1' ; SELECT * FROM table WHERE p2 = 'p2' ; On Tue, May 6, 2025 at 3:14 PM Jaco Kroon via discuss < discuss@lists.mariadb.org> wrote: > Hi, > > On 2025/05/06 16:07, Gordan

[MariaDB discuss] Re: query optimization

2025-05-06 Thread Jaco Kroon via discuss
Hi, On 2025/05/06 16:07, Gordan Bobic wrote: Is there an overwhelming reason why can you not instead search for: SELECT * FROM view_name WHERE p1 = 'p1' and p2 = 'p2'? The application in use configures a table name only, and assumes a single id column with a string value against which to mat

[MariaDB discuss] Re: query optimization

2025-05-06 Thread Gordan Bobic via discuss
Is there an overwhelming reason why can you not instead search for: SELECT * FROM view_name WHERE p1 = 'p1' and p2 = 'p2'? On Tue, 6 May 2025 at 16:58, Jaco Kroon via discuss wrote: > > Hi All, > > So I'm stuck with an application that does something like (can't > trivially modify the code): > >