cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

ui: show estimated schema change progress

Open vivekmenezes opened this issue 10 years ago • 17 comments

We have at least two places where having an efficient way to compute the estimated length of a table is valuable.

  1. column showing the size of a table.
  2. column showing the progress made by a schema change. A schema change is aware of how may rows it has processed but is unable to know how many rows are yet unprocessed.

Having an estimate is good enough for both these use cases.

Jira issue: CRDB-6139

vivekmenezes avatar Oct 27 '16 14:10 vivekmenezes

number of ranges * estimated number of rows per range

is one solution

vivekmenezes avatar Oct 27 '16 14:10 vivekmenezes

We already track keys per range and the schema change op could track the number of keys it processed.

On Thursday, October 27, 2016, vivekmenezes [email protected] wrote:

number of ranges * estimated number of rows per range

is one solution

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cockroachdb/cockroach/issues/10265#issuecomment-256664339, or mute the thread https://github.com/notifications/unsubscribe-auth/AF6f95ahtzaHi1aYdMcGELzq79vemSuOks5q4LqtgaJpZM4KicVZ .

petermattis avatar Oct 27 '16 15:10 petermattis

(sent this via e-mail, but it didn't show up in the issue)

Is keys-per-range a good estimate of rowcount? We need to pin down how that number interacts with, for example, column families. I'm pretty sure that interleaved tables also throw a wrench into this.

If we could get a per-range count of keys into these specific categories, we could provide accurate stats with our current fan-out system.

mrtracy avatar Oct 27 '16 20:10 mrtracy

exceptionally excellent

vivekmenezes avatar Oct 27 '16 20:10 vivekmenezes

Is keys-per-range a good estimate of rowcount? We need to pin down how that number interacts with, for example, column families. I'm pretty sure that interleaved tables also throw a wrench into this.

If we could get a per-range count of keys into these specific categories, we could provide accurate stats with our current fan-out system.

On Thu, Oct 27, 2016 at 11:36 AM, Peter Mattis [email protected] wrote:

We already track keys per range and the schema change op could track the number of keys it processed.

On Thursday, October 27, 2016, vivekmenezes [email protected] wrote:

number of ranges * estimated number of rows per range

is one solution

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/cockroachdb/cockroach/issues/ 10265#issuecomment-256664339>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AF6f95ahtzaHi1aYdMcGELzq79vemSuOks5q4LqtgaJpZM4KicVZ>

.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/cockroachdb/cockroach/issues/10265#issuecomment-256677887, or mute the thread https://github.com/notifications/unsubscribe-auth/AGpaAly2UoZF5n2uHyygciAOzeQ3DUOKks5q4MTkgaJpZM4KicVZ .

mrtracy avatar Oct 27 '16 21:10 mrtracy

Is keys-per-range a good estimate of rowcount?

No, but why do we need an estimate of the row count to compute schema change progress? If we had an estimated row count we could certainly use it to estimate schema change progress, but we could also use an estimate of key count because the schema changer could keep track of the number of keys it has processed.

petermattis avatar Oct 27 '16 21:10 petermattis

The schema changer would do well with an estimate, even a query optimizer might do well with an estimate, but what do we want to display in the UI? I'm assuming that it's probably okay to display estimates that are significantly inexact due to previously mentioned issues (column families, interleaved tables); one would need only to run a SELECT COUNT(*) on a table to show a pretty big discrepancy. Assuming it's not computationally expensive, wouldn't we want more exact information available?

mrtracy avatar Oct 27 '16 22:10 mrtracy

I think this issue has conflated the two problems listed in the original message. We don't need the same mechanism to solve both problems. I'm proposing we punt on the UI row count problem and solve the schema change progress problem by using key counts.

Assuming it's not computationally expensive, wouldn't we want more exact information available?

Yes, but I haven't heard a good way to do this. In a previous message you pointed out how column families and interleaved tables make any sort of row count from key count estimation complex. Did I miss something you were proposing here?

petermattis avatar Oct 28 '16 00:10 petermattis

I seem to remember that we were doing this in order to track progress of schema changes? If so, haven't we done that? @jordanlewis Can we close out?

dianasaur323 avatar Jun 19 '17 18:06 dianasaur323

No, this is still a useful feature to have. The issue summary contains another use case besides schema change progress, and schema change progress could be more fine-grained if we had a row count estimate. Currently, schema change progress relies on the coarse-grained estimation strategy of considering the number of ranges touched by the keyspan of the primary index of the table to backfill.

jordanlewis avatar Jun 19 '17 19:06 jordanlewis

Ok, thanks! It doesn't sound like there is any immediate need to work on this, so I've left it under the "later" milestone for now.

dianasaur323 avatar Jun 20 '17 20:06 dianasaur323

Since #9434 tracks just wanting an estimated row count (useful in & of itself), I'm renaming this issue to reflect the focus on schema change progress.

vilterp avatar Mar 21 '18 05:03 vilterp

Don't we already have this implemented at least for some schema changes (column and index backfill)?

cc @lucy-zhang @ajwerner

jordanlewis avatar Oct 05 '20 22:10 jordanlewis

Yeah, we already track the backfill progress. One problem is that the progress doesn't include the queries used for constraint or index validation (which could be most of the schema change running time).

thoszhang avatar Oct 06 '20 00:10 thoszhang

I think @dt was thinking about hooking up query progress to the schema change job progress.

thoszhang avatar Oct 06 '20 00:10 thoszhang

I hacked on adding query progress to SHOW QUERIES as a free-friday project last year with an eye towards making EXPORT a job one day, but didn't go any further than that. I'm not sure if SQL folks maintained progress support in vectorized queries so it might have rotted.

dt avatar Oct 06 '20 14:10 dt

We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!

github-actions[bot] avatar Sep 26 '23 11:09 github-actions[bot]