Skip to content

Conversation

rmloveland
Copy link
Contributor

Fixes #3397.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@cockroach-teamcity
Copy link
Member

@rmloveland rmloveland requested a review from tim-o January 17, 2019 16:19
@@ -48,6 +48,8 @@ When a table is created, all columns are stored as a single column family. This

[Interleaving tables](interleave-in-parent.html) improves query performance by optimizing the key-value structure of closely related tables, attempting to keep data on the same key-value range if it's likely to be read and written together. This is particularly helpful if the tables are frequently joined on the columns that consist of the interleaving relationship.

However, the above is only true for tables where all operations (i.e., [`SELECT`](selection-queries.html), [`INSERT`](insert.html), [`UPDATE`](update.html), and [`DELETE`](delete.html)) are performed on a single value shared between both tables. After interleaving, operations that span multiple values, or that do not specify the interleaved parent ID, will be significantly slower than they were prior to interleaving the tables.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write (e.g., SELECT or INSERT) instead of trying to list all of them. As it is now you're forgetting half a dozen already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing now, thanks.

Follow-up question: Does this information also apply to the following versions?

  • 2.0.*
  • 2.2

If so I'll add this information there as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, updated this PR so this info is added to the 2.1 and 2.2 docs. Raphael, if you confirm it applies to 2.0, I'll add it there as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I like this better.

But what of this phrasing "significantly slower"?
What does the word "significantly" mean? Significant according to which standard? Compared to what?

I think it may be useful to explain a little more: when the data is interleaved, queries that work on the parent table(s) will need to "skip over" the data in interleave children. This increases the read and write latencies to the parent in proportion to the number of interleaved values.

(Conversely: if there are only few interleaved values, the performance will not be "significantly" slower.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the word "significantly" mean? Significant according to which standard? Compared to what?

screen shot 2019-01-24 at 11 55 46 am

😂

Thanks for this additional feedback, Raphael.

I have attempted another revision that includes this information, rewritten slightly for clarity. Please let me know what you think.

@rmloveland rmloveland force-pushed the 20190117-interleave-table-update branch from ca689c8 to 3e522c8 Compare January 23, 2019 20:17
@cockroach-teamcity
Copy link
Member

@rmloveland rmloveland force-pushed the 20190117-interleave-table-update branch from 3e522c8 to 20a3bb0 Compare January 24, 2019 17:08
Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@rmloveland rmloveland requested review from jseldess and removed request for tim-o January 24, 2019 17:11
@cockroach-teamcity
Copy link
Member

Copy link
Contributor

@jseldess jseldess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:, with a nit.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @jseldess, @knz, and @rmloveland)


v2.1/performance-best-practices-overview.md, line 51 at r2 (raw file):

[Interleaving tables](interleave-in-parent.html) improves query performance by optimizing the key-value structure of closely related tables, attempting to keep data on the same key-value range if it's likely to be read and written together. This is particularly helpful if the tables are frequently joined on the columns that consist of the interleaving relationship.

However, the above is only true for tables where all operations (e.g., [`SELECT`](selection-queries.html) or [`INSERT`](insert.html)) are performed on a single value shared between both tables.  The following types of operations may actually become slower after interleaving:

nit: Use only one space after periods.

@rmloveland rmloveland force-pushed the 20190117-interleave-table-update branch from 20a3bb0 to fe267ac Compare January 28, 2019 15:47
@cockroach-teamcity
Copy link
Member

@rmloveland rmloveland merged commit 44a5073 into master Jan 28, 2019
@rmloveland rmloveland deleted the 20190117-interleave-table-update branch January 28, 2019 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants