-
Notifications
You must be signed in to change notification settings - Fork 23
videx-for-postgresql #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Cool, a great PR! I will try and review this PR this week, thanks @TiNnNnnn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds PostgreSQL support to the Videx virtual index system, enabling it to work as a PostgreSQL plugin/extension alongside the existing MySQL implementation. The implementation includes both Python-side metadata management and a C/C++ PostgreSQL extension for table access methods and statistics hooks.
Key Changes:
- Adds a PostgreSQL extension (
src/pg/videx/) implementing custom table access methods and statistics copying functionality - Refactors Python metadata classes to use base abstractions supporting both MySQL and PostgreSQL
- Implements PostgreSQL-specific metadata fetching and statistics management in Python
Reviewed changes
Copilot reviewed 27 out of 30 changed files in this pull request and generated 59 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pg/videx/* | New PostgreSQL extension implementation including table access methods, statistics hooks, and JSON communication utilities |
| src/sub_platforms/sql_opt/pg_meta.py | PostgreSQL-specific metadata classes (PGTable, PGColumn, PGIndex, PGStatistic) |
| src/sub_platforms/sql_opt/meta_base.py | New base classes for database-agnostic table/column/index abstractions |
| src/sub_platforms/sql_opt/meta.py | Refactored MySQL metadata classes to inherit from base classes |
| src/sub_platforms/sql_opt/videx/videx_pg_metadata.py | PostgreSQL metadata fetching and construction logic |
| src/sub_platforms/sql_opt/videx/videx_mysql_utils.py | Refactored connection configs with PostgreSQL support added |
| src/sub_platforms/sql_opt/videx/videx_utils.py | Added schema/table serialization utilities for PostgreSQL |
| src/sub_platforms/sql_opt/videx/videx_service.py | Added PostgreSQL environment creation function |
| src/sub_platforms/sql_opt/videx/scripts/videx_build_env.py | Extended build script with PostgreSQL support |
| src/sub_platforms/sql_opt/env/rds_env.py | New OpenPGEnv and DirectConnectPGEnv classes for PostgreSQL connections |
| src/sub_platforms/sql_opt/databases/pg/* | PostgreSQL command execution and metadata retrieval implementation |
| src/sub_platforms/sql_opt/column_statastics/* | Refactored statistics classes with base abstractions |
Comments suppressed due to low confidence (1)
src/sub_platforms/sql_opt/videx/scripts/videx_build_env.py:287
- Call to function get_usage_message with too few arguments; should be no fewer than 8.
logging.info(get_usage_message(args, videx_ip, videx_port, videx_db, videx_user, videx_pwd, videx_server_ip_port))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @TiNnNnnn, thanks a lot for the contribution — adding PostgreSQL support is a big step. I have a few questions / suggestions before this becomes easy to reproduce and deeply-reviewed:
Thanks again — happy to help test the PG quick-start once the environment/doc is done. |
…get_relation_stats
6aba94d to
a9902ea
Compare
Videx For Postgresql
Videx-for-pg is developing in the form of a PostgreSQL plugin...
[done] run with videx-statistic-server, support fetch all statistic except pg-statistic-ext
[wip] support e2e card injection during optimizing
How It Works
Where is the statistical information stored?
Postgres stores statistical information in the following system tables:
How does the optimizer obtain statistics?
postgres fetch statistics for relations depends on three core function:
videx-for-postgres fetch statistic from system tables and upload them to videx-statistic-server. At the same time, use a hook method to make the statistics retrieval function prioritize obtaining statistics from the videx-statistic-server.
Quick Start With Videx-Statistic-Server
step1: install postgresql from source code
step2: compile videx
make && make installstep3: Configure and start postgresql server
Edit postgresql.conf in {data_dir},set shared_preload_libraries as videx, then postgresql while load videx.so while starting:
we assume no password is set:
{target_dir}/bin/postgres -D {data_dir} -p 55555step4:register videx in pg
connect postgres with psql (connect to database: postgres defaultly, we can create another databases this database):
{target_dir}/bin/psql -U postgres -p 55555you can also directly install postgresql-client, then you can use psql under any directory:
sudo apt install -y postgresql-client // for ubuntustep3: use videx
verify if the registration was successful