Skip to content

Conversation

@AayushTyagi1
Copy link
Contributor

@AayushTyagi1 AayushTyagi1 commented Oct 16, 2025

Support GSI Index Tools + Advisor

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AayushTyagi1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the system's database optimization capabilities by integrating with the Couchbase Index Advisor. It provides new functionalities that allow users to automatically retrieve index recommendations for their SQL++ queries and then apply those recommendations by creating new indexes. This streamlines the process of improving query performance and managing database indexes more efficiently.

Highlights

  • New Index Management Tools: Introduced two new tools to facilitate Couchbase index management: one for retrieving index recommendations and another for creating indexes.
  • Index Advisor Integration: Added a tool, get_index_advisor_recommendations, that queries the Couchbase Index Advisor to provide optimal index suggestions for SQL++ queries.
  • Programmatic Index Creation: Implemented a tool, create_index_from_recommendation, allowing programmatic creation of indexes from CREATE INDEX statements, including checks for read-only mode and robust error handling.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the Couchbase Index Advisor by introducing two new tools: one for fetching index recommendations and another for creating indexes based on them. The implementation is well-structured, with good documentation and error handling. My review includes a few suggestions for the new src/tools/index.py file to improve API clarity by removing unused parameters and to enhance code readability with a minor simplification.

@AayushTyagi1 AayushTyagi1 requested a review from nithishr October 16, 2025 06:02
Copy link
Contributor

@nithishr nithishr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functionality works well overall. Just couple of things to clarify.

raise


def create_index_from_recommendation(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this tool? This is not too different from the run_sql_plus_plus_query() right?

logger.info("Running Index Advisor for the provided query")

# Execute the ADVISOR function at cluster level
result = cluster.query(advisor_query)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the run_cluster_query() in query tools?
That should get you the same results.


try:
# Escape single quotes in the query by doubling them for SQL++ string literal
escaped_query = query.replace("'", "''")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? LLMs are generally pretty good at formatting the strings as required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this test & it looks good otherwise

@AayushTyagi1
Copy link
Contributor Author

@nithishr
Deleted Let's merge this one so that I can resolve the conflict between two

@AayushTyagi1 AayushTyagi1 requested a review from nithishr October 22, 2025 18:08
@AayushTyagi1 AayushTyagi1 merged commit 3ca6c73 into main Oct 22, 2025
6 checks passed
@nithishr nithishr deleted the feature/DA-1170-add-support-for-index-advisor branch November 12, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants