Skip to content

Commit

Permalink
chore: updates for build.
Browse files Browse the repository at this point in the history
  • Loading branch information
billy-the-fish committed Jan 9, 2025
1 parent 993cf07 commit d1fde35
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions api/hypercore/convert_to_rowstore.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ api:
license: community
type: function
---

import Since2180 from "versionContent/_partials/_since_2_18_0.mdx";

# convert_to_rowstore() <Tag type="community">Community</Tag>
Expand All @@ -25,12 +26,12 @@ This workflow is especially useful if you need to backfill old data.

To modify or add a lot of data to a chunk:

<Procedure>
1. **Stop the [jobs][alter_job] that are automatically adding chunks to the columnstore**

1. **Stop the [jobs][alter_job] that are automatically adding chunks to the columnstore**
``` sql
SELECT alter_job(JOB_ID, scheduled => false);
```

You retrieve the list of jobs from the [timescaledb_information.jobs][informational-views] view.

1. **Convert the chunks to update back to the rowstore**
Expand All @@ -49,33 +50,34 @@ To modify or add a lot of data to a chunk:

1. **[Update the data][insert] in the chunk you added to the rowstore**

Best practice is to structure your INSERT statement to include appropriate
partition key values, such as the timestamp. TimescaleDB adds the data to the correct chunk:
Best practice is to structure your INSERT statement to include appropriate
partition key values, such as the timestamp. TimescaleDB adds the data to the correct chunk:

``` sql
INSERT INTO metrics (time, value)
VALUES ('2025-01-01T00:00:00', 42);
```

1. **Convert the updated chunks back to the columnstore**

``` sql
SELECT convert_to_columnstore('_timescaledb_internal._hyper_1_2_chunk');
```

1. **Restart the [jobs][alter_job] that are automatically adding chunks to the columnstore**

``` sql
SELECT alter_job(JOB_ID, scheduled => true);
```

</Procedure>

## Arguments

| Name | Type | Default | Required | Description |
|--|--|--|--|------------------------------------------------------------------------------------------------------------|
|`chunk`|`REGCLASS`|-|✖| Name of the chunk to be moved to the rowstore. |
| Name | Type | Default | Required | Description|
|--|--|--|--|-|
|`chunk`|`REGCLASS`|-|✖| Name of the chunk to be moved to the rowstore. |
|`if_compressed`|`BOOLEAN`|`true`|✔| Set to `false` so this job fails with an error rather than an warning if `chunk` is not in the columnstore |


[job]: /api/:currentVersion:/actions/
[alter_job]: /api/:currentVersion:/actions/alter_job/
[convert_to_columnstore]: /api/:currentVersion:/hypercore/convert_to_columnstore/
Expand Down

0 comments on commit d1fde35

Please sign in to comment.