# CTAS or ITAS - max\_execution\_time

**URL:** <https://forums.percona.com/t/ctas-or-itas-max-execution-time/9622>\
**Category:** Percona Server for MySQL 8.0\
**Tags:** mysql, percona\
**Created:** [March 10, 2021, 12:53pm UTC](https://forums.percona.com/t/ctas-or-itas-max-execution-time/9622 "2021-03-10T12:53:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matias\_Sanchez](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matias_sanchez/32/2808_2.png) [@Matias\_Sanchez](https://forums.percona.com/u/Matias_Sanchez)\
**Post date:** [March 10, 2021, 12:53pm UTC](https://forums.percona.com/t/ctas-or-itas-max-execution-time/9622/1 "2021-03-10T12:53:23Z")

</div>

Hi Guys!  
Got a concern regarding execution time limit for specific type of SQL statements. We are migrating our database from Mariadb to Percona for Mysql and we are used to rely on the "set statement max\_statement\_time for " (Mariadb scope) apart for select statements, the main extra usage is in Create [temporary] table as Select or Insert as Select.  
I’ve further checked that when applying the limit on the select clause, as this:

CREATE TEMPORARY TABLE tmp (id int) AS SELECT /\*+ MAX\_EXECUTION\_TIME(xx) \*/ …

the limit is not working properly. I’ve tested the case when an specific select gets interrupted, but when the same select is part of a CTAS , the interruption is not raised.

Also the same check was done as a CREATE TABLE + INSERT AS SELECT , but got same results. Another check was on a set local variable max\_execution\_time, but again not success.

This CTAS max\_execution\_time are not supported at percona mysql? or is there any workaround possible to set this limit in this type of clauses?

Thanks you in advance for any help 🙂

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [March 10, 2021, 1:06pm UTC](https://forums.percona.com/t/ctas-or-itas-max-execution-time/9622/2 "2021-03-10T13:06:32Z")

</div>

Percona Server matches MySQL behavior in this case

[https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-execution-time](https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-execution-time)

This is considered to be a hint and it only works for SELECT questions and ignored for others. It is not the best usability in my opinion and I’d file a bug/FR with MySQL team so they are aware there is demand for this feature beyond SELECTs

---

<div class="post-metadata">

**Author:** ![Matias\_Sanchez](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matias_sanchez/32/2808_2.png) [@Matias\_Sanchez](https://forums.percona.com/u/Matias_Sanchez)\
**Post date:** [March 10, 2021, 1:25pm UTC](https://forums.percona.com/t/ctas-or-itas-max-execution-time/9622/3 "2021-03-10T13:25:29Z")

</div>

Thanks a lot Peter for your replay, i’m creating a FR for MySQL team on this matter and in the meanwhile i’ll try out a workaround with pt-kill schedules or similar approach.

Thanks a lot!

Best regards.

---

<div class="post-metadata">

**Author:** ![Matias\_Sanchez](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matias_sanchez/32/2808_2.png) [@Matias\_Sanchez](https://forums.percona.com/u/Matias_Sanchez)\
**Post date:** [March 10, 2021, 1:51pm UTC](https://forums.percona.com/t/ctas-or-itas-max-execution-time/9622/4 "2021-03-10T13:51:13Z")

</div>

[https://bugs.mysql.com/bug.php?id=102903](https://bugs.mysql.com/bug.php?id=102903)
