Posts

AI Chat With DBeaver Community Edition

Image
  DBeaver recently introduced interactive chat capabilities into the free, open-source Community Edition. What does that mean?  It means some of your database tasks can be accomplished significantly faster !  First , you can ask for information without coding SQL. I love Structured Query Language, but it is much faster to write this prompt: What are the top ten most popular rentals and how much revenue did they generate? And faster than I look at the schema, the AI answers: -- This query finds the top 10 most rented films and the total revenue they generated. select f . film_id , f . title , count ( r . rental_id ) as rental_count , coalesce ( sum ( p . amount ), 0 ) as total_revenue from film f join inventory i on f . film_id = i . film_id join rental r on i . inventory_id = r . inventory_id left join payment p on r . rental_id = p . rental_id group by f . film_id , f . title order by rental_count desc , total_revenue desc limi...

Ever Run Into A PostgreSQL Query That You Can Figure Out What It Does??

Image
 Ever have a query 'tossed over the fence' that you find incomprehensible but still have to support it? A few years ago, you would have needed to triage the query. Obfuscated queries can be tough to decipher.  Sometimes, the query is due to someone or an ORM being clever. Many times the query is touch to read because the  DBeaver recently added its AI Chat to the free, open-source DBeaver Community Edition. And you will find it very at determining what a query does. Let's start with a simple query. Open AI Assistant Where to find the AI Assistant DBeaver 26.1.2's AI Assistant can be found on the main menu under 'AI'. Input Prompt Once you have the AI Assistant open, ask 'what does this do'? Prompt with a query Explanation The AI will examine what you gave it and report back. I am using OpenAI with the gpt-4o engine.  The Query Explained Hopefully, you were able to recognize this simple query, which reports the number of dead tuples. Okay, let us try some...

PostgreSQL, Timezones, and DBeaver

Image
Time zones are an unfortunately complex subject when dealing with PostgreSQL. You may be running your local time zone on your on-premises server or on your own laptop. Or you may be using the time zone of your server’s physical location. And you may have set all your servers to UTC. And all are valid approaches, depending on your circumstances. DBeaver users know it is a very advanced tool for database work. But it is easy to get into time zone issues, as the default time zone for your session is taken from your client machine. But this can be adjusted. UTC? UTC or Universal Time Coordinated is a time zone standard used as a basis for all time zones worldwide. It is a constant time scale and does not change for Daylight Saving Time (DST). The benefits include streamlined cross-region data synchronization, easier debugging, accurate time-based transaction ordering, and scalability for global applications. In distributed systems, storing data in UTC ensures that logs and transactions ar...