Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-245

Support declaring primary key columns as REVERSE to avoid hotspotting

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Resolution: Fixed
    • None
    • None
    • None
    • 114

    Description

      One technique to prevent write hot-spotting when you have a monotonically increasing key is to reverse the bits. This works well if you don't need to do a range scan across the values. One use case is when your first column represents a tenant ID in a multi tenant system.

      This would be implemented by building on the fix for [this issue](https://github.com/forcedotcom/phoenix/issues/58):

      1. Add a new enum for REVERSE
      2. Change the serialization/deserialization code in PDataType to reverse the bits in the case of REVERSE.
      3. Disallow range scans on columns of type REVERSE. This could be caught in ExpressionCompiler_visitLeave(ComparisonParseNode,List<Expression>) and ExpressionCompiler_visitLeave(LikeParseNode,List<Expression>). These are the two cases I can think of that result in range scans.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            aaraujo aaraujo
            jamestaylor James R. Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment