Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placement behavior for temporary table #28309

Closed
Tracked by #18030
lcwangchao opened this issue Sep 24, 2021 · 4 comments
Closed
Tracked by #18030

Placement behavior for temporary table #28309

lcwangchao opened this issue Sep 24, 2021 · 4 comments
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@lcwangchao
Copy link
Collaborator

lcwangchao commented Sep 24, 2021

We should clarify the placement rule behavior on temporary table.

  • Create/Update: Placement rule is meaningless for both global and local temporary tables, so we should forbid all placement options when creating or updating a global/local temporary table

  • SHOW PLACEMENT: The problem is local temporary table. For local temporary table, it is allowed to have a same name with a normal table in the same database. We should clarify the show behavior. For example, a normal table test.t1 is configured with some placement options and a local temporary table with the same name also exists. What should SHOW PLACEMENT returns? A row display normal table's placement or dismiss this row because a local temporary table exists? I prefer to ignore local temporary table in this situation just like SHOW TABLES .

  • SHOW PLACEMENT FOR TABLE : The same problem with SHOW PLACEMENT . But I prefer to use the local temporary table as the target table for this case just like what SHOW CREATE TABLE does. So, for SHOW PLACEMENT FOR TABLE t1, if a local temporary table exists in the current database, it always returns an empty result set ignoring the normal table.

@lcwangchao lcwangchao added the type/enhancement The issue or PR belongs to an enhancement. label Sep 24, 2021
@morgo
Copy link
Contributor

morgo commented Sep 24, 2021

@lcwangchao LGTM, I agree with all 3 behaviors.

@morgo
Copy link
Contributor

morgo commented Oct 11, 2021

I have fixed the first issue in a PR. To fix the 3rd issue the result of the last 2 statements should be the same:

mysql> create temporary table t (a int);
Query OK, 0 rows affected (0.00 sec)

mysql> show placement for table test.t;
Empty set (0.00 sec)

mysql> show placement for table test.nn;
ERROR 1146 (42S02): Table 'test.nn' doesn't exist

@morgo
Copy link
Contributor

morgo commented Oct 13, 2021

Notes:

The PR merged might be a bit simplistic and miss CREATE TABLE LIKE and CREATE GLOBAL TEMPORARY TABLE. We can followup in a further PR.

@morgo
Copy link
Contributor

morgo commented Oct 25, 2021

This has been fixed

@morgo morgo closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants