Sargable Custom Functions in Queries
Is there any way to enforce a custom function to be Sargable with a query? I've run multiple tests, and even with a simple function that returns a static number, it seems to take 2x as long as hardcoding the number of putting it in a Variable.
For example, doing a query that has a qualifier like:
WHERE table.column = 4
Is of course the fastest with indexing.
WHERE table.column = variable (which =4)
Is the same speed.
BUT WHERE table.column = DETERMINISTIC FUNCTION RESULT (4)
Takes 2x+ longer.
This seems ridiculous to me as functions are a critical part of complex SQL queries.
Is there any way to have MySQL treat a function call as a sargable application against a query?
Subject
Written By
Posted
Sargable Custom Functions in Queries
December 02, 2021 05:01PM
December 02, 2021 08:16PM
December 05, 2021 03:27PM
December 03, 2021 09:38AM
December 05, 2021 03:27PM
Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.