DEV Community

Gleb Otochkin for Google AI

Posted on • Originally published at Medium on

7 Times Faster and Cheaper? Gemini 3.5 Flash Lite and Gemini 3.6 Flash in Google Cloud Databases

Only a couple of months ago, I wrote a blog post describing how to enable the latest (at the time) Gemini 3.5 Flash in Google Cloud databases. Now, it is time to introduce the newest model: Gemini 3.6 Flash. This model is fresher, with a knowledge cutoff date around the end of March this year, and it costs less. Let’s look at how it performs at first glance. I am particularly curious about its response times and how it compares to the previous model.

Cloud SQL

For Cloud SQL for Postgres, don’t forget to enable full AI integration via the google_ml extension to call modelsdirectly from a SQL query. If you are reading this AI integration overview right after the model announcement, you might need to register the model first. It wasn’t available by default when I tested it.

Here is the SQL statement to register the model. Don’t forget to replace the PROJECT_ID placeholder in the code with your actual Google Cloud project ID:

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

After that, your model is ready to be used:

SELECT google_ml.predict_row(
    model_id => 'gemini-3.6-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

To measure the latency, I’ve asked Google Antigravity to prepare a PL/pgSQL function to run that query a certain number of times and aggregate the results. It did a decent job, I needed only a few polishing and adjustments to make it working. Here are my benchmarking results for Gemini 3.6 Flash and Gemini 3.5 Flash:

quickstart_db=> SELECT * FROM benchmark_model_predictions('gemini-3.6-flash', 10);
 total_runs | avg_latency_ms | median_latency_ms | min_latency_ms | max_latency_ms 
------------+----------------+-------------------+----------------+----------------
         10 | 3694.53 | 3725.52 | 3313.01 | 4213.40
(1 row)

Time: 36947.554 ms (00:36.948)
quickstart_db=> SELECT * FROM benchmark_model_predictions('gemini-3.5-flash', 10);
 total_runs | avg_latency_ms | median_latency_ms | min_latency_ms | max_latency_ms 
------------+----------------+-------------------+----------------+----------------
         10 | 4918.86 | 5136.67 | 3936.69 | 5722.01
(1 row)

Time: 49190.861 ms (00:49.191)
Enter fullscreen mode Exit fullscreen mode

It looks like, all other conditions being equal, Gemini 3.6 Flash was slightly faster than the previous model. Of course, this is a very crude measurement, and your results may vary. Since we are using a global endpoint, the routing might theoretically hit different regional endpoints. Furthermore, public model endpoints are shared services.

Next, I created a function to evaluate the quality of the responses and ran it for both models. The function uses the same query, receives the response, and sends the result to a more advanced model for evaluation. In this case, I used gemini-3.1-pro-preview as the judge:

quickstart_db=> SELECT * FROM benchmark_model_quality('gemini-3.6-flash', 'gemini-3.1-pro-preview', 5);
 total_runs | avg_quality_score | median_quality_score | min_quality_score | max_quality_score 
------------+-------------------+----------------------+-------------------+-------------------
          5 | 10.00 | 10.00 | 10 | 10
(1 row)

quickstart_db=> SELECT * FROM benchmark_model_quality('gemini-3.5-flash', 'gemini-3.1-pro-preview', 5);
 total_runs | avg_quality_score | median_quality_score | min_quality_score | max_quality_score 
------------+-------------------+----------------------+-------------------+-------------------
          5 | 9.80 | 10.00 | 9 | 10
(1 row)

quickstart_db=>
Enter fullscreen mode Exit fullscreen mode

Both models delivered excellent results, but Gemini 3.6 Flash provided slightly better responses than its predecessor — at least according to the gemini-3.1-pro-preview judge.

What about AlloyDB? Let’s run the same performance benchmark on AlloyDB to see if the response times match our Cloud SQL results.

AlloyDB

Registering the new model in AlloyDB follows almost the same process, with the only difference being the ‘model_type’ parameter. In AlloyDB, we register it with the model type ‘llm’. Again, don’t forget to replace the PROJECT_ID placeholder with your actual project:

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

For these tests, I used the exact same query and function as we did for Cloud SQL. AlloyDB is fully compatible with PostgreSQL and shares the same AI integration extension.

quickstart_db=> SELECT * FROM benchmark_model_predictions('gemini-3.5-flash', 10);
 total_runs | avg_latency_ms | median_latency_ms | min_latency_ms | max_latency_ms
------------+----------------+-------------------+----------------+----------------
         10 | 4899.00 | 4910.05 | 3631.22 | 5798.40
(1 row)

Time: 48992.149 ms (00:48.992)
quickstart_db=> SELECT * FROM benchmark_model_predictions('gemini-3.6-flash', 10);
 total_runs | avg_latency_ms | median_latency_ms | min_latency_ms | max_latency_ms
------------+----------------+-------------------+----------------+----------------
         10 | 4364.76 | 4368.65 | 3664.24 | 5008.42
(1 row)

Time: 43649.384 ms (00:43.649)
quickstart_db=>
Enter fullscreen mode Exit fullscreen mode

This time, the results were much closer, and the response times were almost identical. It is hard to draw definitive conclusions here, considering we are using a shared service with global routing; there is no guarantee that consecutive requests are hitting the same physical endpoint. However, it appears that performance and response times are roughly equivalent for both models. Naturally, the quality of the responses remained consistent with our previous test, as quality depends directly on the models themselves.

Gemini 3.5 Flash Lite

But do you always need a “Pro” or “Flash” model for your queries? In many cases, you can get highly acceptable results from a “Lite” model like the newly released gemini-3.5-flash-lite. I tested its performance using the same benchmarking approach:

quickstart_db=> SELECT * FROM benchmark_model_predictions('gemini-3.5-flash-lite', 10);
 total_runs | avg_latency_ms | median_latency_ms | min_latency_ms | max_latency_ms
------------+----------------+-------------------+----------------+----------------
         10 | 827.08 | 882.05 | 499.95 | 1034.92
(1 row)

Time: 8272.929 ms (00:08.273)
Enter fullscreen mode Exit fullscreen mode

It was about seven times faster than Gemini 3.6 Flash. But what about response quality?

quickstart_db=> SELECT * FROM benchmark_model_quality('gemini-3.5-flash-lite', 'gemini-3.1-pro-preview', 5);
 total_runs | avg_quality_score | median_quality_score | min_quality_score | max_quality_score
------------+-------------------+----------------------+-------------------+-------------------
          5 | 10.00 | 10.00 | 10 | 10
(1 row)

Time: 42923.480 ms (00:42.923)
quickstart_db=> SELECT * FROM benchmark_model_quality('gemini-3.5-flash-lite', 'gemini-3.1-pro-preview', 5);
 total_runs | avg_quality_score | median_quality_score | min_quality_score | max_quality_score
------------+-------------------+----------------------+-------------------+-------------------
          5 | 9.60 | 10.00 | 8 | 10
(1 row)

Time: 51722.997 ms (00:51.723)
quickstart_db=> SELECT * FROM benchmark_model_quality('gemini-3.5-flash-lite', 'gemini-3.1-pro-preview', 5);
 total_runs | avg_quality_score | median_quality_score | min_quality_score | max_quality_score
------------+-------------------+----------------------+-------------------+-------------------
          5 | 9.80 | 10.00 | 9 | 10
(1 row)

Time: 53252.325 ms (00:53.252)
Enter fullscreen mode Exit fullscreen mode

I ran the same benchmark three times, and even the worst-performing run was highly scored. The average scores ranged from 9.6 to 10 (with 10 being a perfect score). I was impressed by both the quality and the speed.

Summary

The new Gemini 3.6 Flash model is less expensive than Gemini 3.5 Flash. Considering it offers comparable or better quality and the same or faster response times, it is definitely a win.

However, Gemini 3.5 Flash Lite is maybe even more impressive, delivering excellent quality while running seven times faster at a very attractive price. This means that many simpler, everyday tasks can be delegated to the Lite model to keep costs down, reserving more advanced models for complex problems that require deep reasoning and multi-step iterations.


Top comments (0)