jorgerojas26 / lazysql

A cross-platform TUI database management tool written in Go.
MIT License
707 stars 35 forks source link

It's not friendly when table partitioning is used. #104

Open prochac opened 1 week ago

prochac commented 1 week ago

Partitions are listed among other tables, leading to a very noisy list.

The relations can be easily listed, in Postgres, by

SELECT *
FROM pg_partition_tree('action_gateway');

BTW, MySQL also supports partitioning, but I have zero experience here.

CREATE TABLE sales (
    id INT,
    sale_date DATE,
    amount DECIMAL(10,2)
) PARTITION BY RANGE(YEAR(sale_date)) (
    PARTITION p2021 VALUES LESS THAN (2022),
    PARTITION p2022 VALUES LESS THAN (2023)
);

https://dev.mysql.com/doc/refman/8.4/en/partitioning-overview.html

jorgerojas26 commented 6 days ago

I'm planning to rewrite the entire Tree, right now that code is messy and not scalable, it only supports 3 levels of depth only. In general, i don't like it, so with that rewrite i think it would be easier to implement partitions.

prochac commented 6 days ago

I looked at how it's implemented in DataGrip (which has super slow starts, that's why I'm considering lazysql), and they do use some kind of recursion. Columns, indexes, sequences, triggers, and partitions are one level below the table. And if you open the partition, it's again the columns, indexes...