DEV Community

Gleb Otochkin for Google AI

Posted on • Originally published at Medium on

Gemini 3.5 Flash in Google Cloud Databases

I hope you’ve been able to attend or at least watch the IO 26 keynote. Among other exciting announcements Google introduced the new Gemini 3.5 Flash model, and I immediately went to test it in Cloud SQL and AlloyDB. It worked really well, returning faster and more accurate responses in my particular use case compared to Gemini 2.5 Flash or even Gemini 3 Flash Preview. I encourage you to try it out for yourself and test it with your own workloads. Let me show you how I tested it.

Cloud SQL

Cloud SQL has full AI integration via the google_ml extension and can call models directly from a SQL query. It has several preregistered models, but Gemini 3.5 Flash was not there yet when I tested it. To work with the model, I registered it using the following call. Replace the PROJECT_ID placeholder in the code by your Google project id.

CALL google_ml.create_model(
    model_id => 'gemini-3.5-flash',
    model_request_url => 'https://aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/global/publishers/google/models/gemini-3.5-flash:generateContent',
    model_provider => 'google',
    model_type => 'generic',
    model_auth_type => 'cloudsql_service_agent_iam'
);
Enter fullscreen mode Exit fullscreen mode

If you look at the model_request_url parameter, you’ll notice I’ve put the full URL path there with the global location. And I have a reason for that. Even if Cloud SQL and AlloyDB allow you to use a short variant for the URL, it might not work with the new models. If you try to use something like publishers/google/models/gemini-3.5-flash:generateContent, you will most likely get an error, since by default it tries to use a regional path — which is not available for Gemini 3.5 models.

After the registration, the model can be used in a query or in a function. I tested it with the following query:

SELECT google_ml.predict_row(
    model_id => 'gemini-3.5-flash',
    request_body => json_build_object(
        'contents', json_build_array(
            json_build_object(
                'role', 'user',
                'parts', json_build_array(
                    json_build_object('text', 'Explain MCP server for a relational database in 50 words or less.')
                )
            )
        )
    )
) ->'candidates' -> 0 -> 'content' -> 'parts' -> 0 -> 'text' AS ai_response;
Enter fullscreen mode Exit fullscreen mode

It took about 4.1 seconds to get the response from the Gemini 3.5 Flash model. Then I registered the Gemini 2.5 Flash and Gemini 3 Flash Preview models and repeated the same query using their endpoints. For Gemini 2.5 Flash, it took 5.3 seconds on average, and 12.3 seconds for Gemini 3 Flash Preview. I expected version 3.5 to be faster than the preview version, but it was even faster than version 2.5.

Then we have to look into the quality of the response. Gemini 3.5 Flash provided an answer that aligns better with how the term “MCP” is used today when compared to the response from Gemini 2.5 Flash.

Here is an example of the response from Gemini 2.5 Flash:

“MCP server isn’t a standard term in relational databases. It *could* refer to a Master Control Program in legacy systems, acting as a central process coordinating database operations. It’s not a common component in modern database architectures.”

It looks like Gemini 2.5 Flash talks about an OS for mainframes. I am not sure how relevant that is for a general audience. Now, let’s compare it with the response from Gemini 3.5 Flash.

“An MCP (Model Context Protocol) server is a secure bridge connecting AI models to a relational database. It translates the AI’s natural language requests into SQL commands, allowing the model to safely inspect schemas, query data, and perform database operations in real-time.”

That makes more sense and especially now when everybody uses AI and agents.

Here is the summary table for the models performance:

Model Version | Response Time | Response Quality
-----------------------|---------------|------------------
Gemini 3.5 Flash | 4.1 seconds | Excellent
Gemini 2.5 Flash | 5.3 seconds | Average
Gemini 3 Flash Preview | 12.3 seconds | Good
Enter fullscreen mode Exit fullscreen mode

After the tests with Cloud SQL, I moved to my AlloyDB cluster to see how it worked there.

AlloyDB

I used a very similar procedure to register the new model in the AlloyDB database, with the only difference being the model_type parameter. In AlloyDB, we can register it with the model type “llm”. Again — don’t forget to replace the PROJECT_ID placeholder by your project id.

CALL google_ml.create_model(
model_id => 'gemini-3.5-flash',
model_request_url => 'https://aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/global/publishers/google/models/gemini-3.5-flash:generateContent',
model_provider => 'google',
model_type => 'llm'
);
Enter fullscreen mode Exit fullscreen mode

To test the model in AlloyDB, I used a different function — ai.generate. The ai.generate function is much more convenient to use — you don’t need to prepare your JSON input, and it returns the output as plain text right out of the box.

SELECT ai.generate(
    'Explain MCP server for a relational database in 50 words or less.',
    model_id => 'gemini-3.5-flash'
) AS ai_response;
Enter fullscreen mode Exit fullscreen mode

In AlloyDB, the response from Gemini 3.5 Flash took the same 4.2 seconds on average, with the same high-quality results.

The Gemini 2.5 Flash model was already there out of the box, and I registered Gemini 3 Flash Preview using the same approach as above. After testing the query using ai.generate, I got 5.4 seconds for Gemini 2.5 Flash and 13.1 seconds on average for Gemini 3 Flash Preview. The quality of the response was the same as in my Cloud SQL tests. And the ai.generate on AlloyDB was performing with the same speed as google_ml.predict_row on Cloud SQL. I tested it with both regional and global endpoints getting the same performance.

The new model is more expensive but considering speed and quality of the result it might pay off especially for agentic workload where low quality response can lead to more turns for an agent and more consumption in the end.

Summary

My experience so far with the new Gemini 3.5 Flash model is faster and better responses over the previous Gemini 2.5 Flash model, and it is much faster than the Gemini 3 Flash Preview we have been testing previously. I think it is the new ‘workhorse’ for most of my workloads. Try it out for yourself, and read about the new Gemini model and all the other I/O ’26 announcements in the Google blog.


Top comments (0)