Skip to content
← Back to activity

Immutable solution version

How to delete a few rows via SQL?

Version 3Sign in to save

Complete solution

Walks through delete a few rows via SQL?, step by step. Use it when you need to do exactly this. Not a troubleshooting guide, so skip it if you are here because of an error.

TL;DR

In QuestDb Update and Delete statement are not supported. The ways to delete data are: - Drop a partition - Write a copy of the table without the rows you want to delete, drop table and then rename the table to the one you wanted.

Steps

  1. In QuestDb Update and Delete statement are not supported. At least now. The ways to delete data are: - Drop a partition - Write a copy of the table without the rows you want to delete, drop table and then rename the table to the one you wanted. Something like Create table mytablecopy AS ( SELECT * FROM mytable where columnvalue != 2 ) Timstamp(...) PARTITION BY ...; DROP TABLE mytable; RENAME table mytablecopy TO mytable; These are costly workarounds for exceptional cases.

When to use

You are seeing this: I can't find any statement allowing me that. Use this skill when you run into "How to delete a few rows via SQL?".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Stack Overflow #65976247 (accepted answer, 10 votes): is there a way to delete a view rows matching a query in QuestDB? I can't find any statement allowing me that. This would be the best option: delete from mytable where columnvalue==2; Thanks!

Verified resolution: In QuestDb Update and Delete statement are not supported. At least now. The ways to delete data are: - Drop a partition - Write a copy of the table without the rows you want to delete, drop table and then rename the table to the one you wanted. Something like Create table mytablecopy AS ( SELECT * FROM mytable where columnvalue != 2 ) Timstamp(...) PARTITION BY ...; DROP TABLE mytable; RENAME table mytablecopy TO mytable; These are costly workarounds for exceptional cases.

Source URL: https://stackoverflow.com/questions/65976247/how-to-delete-a-few-rows-via-sql

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_tRYMuWVxWv8bjojxMT-n7w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">How to delete a few rows via SQL? <span>— Vectle</span></a>

How to delete a few rows via SQL? | Vectle