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

[YSQL][Colocation] Create flow #3033

Closed
ndeodhar opened this issue Nov 27, 2019 · 2 comments
Closed

[YSQL][Colocation] Create flow #3033

ndeodhar opened this issue Nov 27, 2019 · 2 comments
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue
Milestone

Comments

@ndeodhar
Copy link
Contributor

ndeodhar commented Nov 27, 2019

Jira Link: [DB-416](https://yugabyte.atlassian.net/browse/DB-416)
Support CREATE DATABASE WITH colocation=true. This should create 1 tablet for the entire DB. All tables created within that database should use the same tablet.

@ndeodhar ndeodhar added the area/ysql Yugabyte SQL (YSQL) label Nov 27, 2019
@ndeodhar ndeodhar added this to the v2.1 milestone Nov 27, 2019
Zhongweizhao pushed a commit that referenced this issue Dec 21, 2019
Summary:
Expand grammar for create colocated db/table
```
CREATE DATABASE ... WITH colocated = true | false
CREATE TABLE ... WITH (colocated = true | false)
```

Creating a colocated database will create a dummy table and a tablet. Every table in the database will share this tablet. Creating a table in a colocated database will make this table colocated by default. User can specify colocated = false to opt out using the colocated tablet

Next step is drop flow and truncate flow.

Test Plan:
`ybd --java-test org.yb.pgsql.TestPgRegressFeature`
`ybd --cxx-test pgwrapper_pg_libpq-test --gtest_filter PgLibPqTest.TabletColocation`
`ybd --cxx-test create-table-itest --gtest_filter CreateTableITest.TabletColocationRemoteBootstrapTest`

Reviewers: neha, mihnea, hector, jason

Reviewed By: hector, jason

Subscribers: bogdan

Differential Revision: https://phabricator.dev.yugabyte.com/D7608
@jaki jaki closed this as completed Dec 23, 2019
@ben-pr-p
Copy link

ben-pr-p commented Jan 24, 2020

When would a Yugabyte DB user want to colocate versus distribute a table?

@ndeodhar
Copy link
Contributor Author

Hi @ben-pr-p , this page has information on when it'll be suitable to use colocated tables (Motivation section at the beginning): https://github.com/yugabyte/yugabyte-db/blob/master/architecture/design/ysql-colocated-tables.md

In a gist, it'll a good choice for following scenarios:

  1. Your database size is small (<500 GB) and you need high availability and geographic distribution.
  2. Your database has a large number of tables, of which most tables are small and only a few are large. In this case, you can colocate the small tables on a single tablet and distribute the large tables.
  3. You want to scale the number of databases. For example, you have 1 database per user / tenant and you want to have large number of databases. In this case, you can colocate all tables in a database in one tablet.

@frozenspider frozenspider changed the title [Colocation] Create flow [YSQL][Colocation] Create flow May 18, 2022
@yugabyte-ci yugabyte-ci added kind/bug This issue is a bug priority/medium Medium priority issue labels May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug priority/medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

5 participants