[MDEV-25838] FUNCTION parameters slow execution time dramatically despite DETERMINISTIC Created: 2021-06-01 Updated: 2021-06-09 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Procedure |
| Affects Version/s: | 10.3.27 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Edouard | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | functions, performance | ||
| Environment: |
Debian Buster |
||
| Description |
|
I know it may not be a bugg. Here what I observed:
Execution last few ms.
It last more than 8 sec. This view is full DETERMINISTIC. What can explain such a gap? Any ways to avoid this? Regards, |
| Comments |
| Comment by Edouard [ 2021-06-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Wouldn't be possible to create a kind of "macro" type function? PREPARE, EXECUTE statement are forbidden in FUNCTION. I know it's sub-optimal. But in this particular case, something like:
would be faster. Regards, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Edouard [ 2021-06-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi guys, If you are here and find this situation crazy. Here is another crazy workaround I didn't find documentation for.
It get executed in few ms. I would be so happy to meet anyone that could explain me why. Regards, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2021-06-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Could you please add the full test case to demonstrate the problem?
| ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Edouard [ 2021-06-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Well how could we proceed? It's a production DB and we have 500 lignes of view source code we would prefer not to share.
It looks like when not using the local var in the function, a SELECT * is done and then the filter, while in the other case the view execution is optimized. Regards, |