[MDEV-15076] Forcing materialize in query used to create view Created: 2018-01-25  Updated: 2018-01-29

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Tadas Balaišis Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I would like to use materialization in CTE construction:

WITH a as (select ...)

to materialize results of some inline query.
This could be done by setting optimizer_switch in previous separate command. But is it possible to use some hint in the statement to use such CTE select to create view?



 Comments   
Comment by Sergei Golubchik [ 2018-01-27 ]

Yes, you can use SET STATEMENT to turn any separate SET into a hint:

SET STATEMENT optimizer_switch="materialization=on" FOR WITH a AS (SELECT ...)

Comment by Tadas Balaišis [ 2018-01-27 ]

How about CTE with several inline queries:

with a as (select ...)
,b as (select ...)
, c as (select ...)

Will it all be materialized?

Comment by Sergei Golubchik [ 2018-01-27 ]

Yes

Comment by Tadas Balaišis [ 2018-01-29 ]

Thank you. That's not very flexible, but it can be used.

Generated at Thu Feb 08 08:18:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.