30/06/2025

PostgreSQL - Restoring a database

Recent days I was following Brent Ozar's site on postgresql - smart postgres.

In his articles and classes he use copy of stackoverflow database (postgres version). There fore I wanted to restore it on my test postgres server.

Here is how I did it.

Download the Dump

First I downloaded the stackoverflow data dump (which was created by Brent) using links in his site. See this page for links to data dump torrent and instructions on restoring and configuring it. 

I choose small version of the data dump (which expand to 6GB, but torrent is about 1GB).

Create a Database

In this scenario, I have used DBeaver to help me with database. In DBeaver, created a new database connection.


See above screenshot for settings I have used. I have kept most settings default, but made sure to tick "Show all databases" tick box, this allows me to see all database in addition to the one you specified in the connection.

Once connection is created, select the database node and right click on it. Select "Create New Database" menu item.


Create database dialog appear and enter the name "stackoverflow" in the database name box. Keep all other settings default and press ok.

Your new database will appear under the database node:


Restore

Right click on the newly created database and select Tools > Restore


This will popup the restore dialog. In restore dialog, browse to the downloaded data dump (.sql) file and make sure to "Discard object owners" tick box.

This will make sure some errors are by passed. Due to the way dump was created there are some mis match of owners. This is explained in Brent's page, but he has advice to ignore them, by ticking above box those errors a skipped,


Then press on "Start" button.

Confirm your request:


Progress will appear on the dialog box and depending on the power of your machine it will take about 2-10 minutes to restore.


Once finished, press cancel on the dialog.

Now you will be able to see stack overflow tables on the database:




11/06/2025

How to find usage information on Github Copilot


Most of you already know, Github copilot is very nice addition to VS code and Visual Studio IDE. Past couple of months, it has been very good coding assistant to me in all coding projects, specially in Visual Studio 2022.

I was using Free plan for Github copilot ever since I have started using it. Limits on free plan was enough for me to work on project I worked in past. However, last couple of week development work has increased, there fore I was wondering whether I'm hitting my free plan limits on Github copilot.

When you hover our Copilot icon on Visual Studio 2022, it give following options:


If you click on the "Copilot Free Status" menu, you get something like below:


It just says, when the free limits will reset (monthly). So how to find out how much you have already used.

This is when ChatGPT with search tool came in handy. Following procedure describe how to find the free limit. It is not very user friendly, but for developers, this is not a complicated task.

Step 1: Login to your Github account and go to following URL (preferably on Chrome or Edge): 

https://github.com/settings/copilot


Step 2: Open Developer Tools

  • Chrome/Edge: Press Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (macOS)

  • Firefox: Ctrl+Shift+K (Windows/Linux) or Cmd+Option+K (macOS)


Step 3: 
Switch to the Network Tab

In Developer Tools, click on the Network tab and ensure “Preserve log” is enabled to keep track of activity when the page reloads.


Step 4: Reload the Page

Hit F5 or reload the browser page. This captures all network requests, including the entitlement API call.



Step 5: Filter Requests

In the Network filter bar, type entitlement to locate the key request:



Step 6: Inspect the Payload
  • Click the request to open the Headers / Response pane.

  • Go to the Response tab — it should display a JSON object detailing your usage quotas and how much remains.


As you can see in above screen shot, json response show the remaining entitlement. To be clear in above example, account has not used any of his/her entitlement.







Introduction to SQL Server Transactions (Transaction Isolation Part 3)

This is third part of "Introduction to SQL Server Transaction" series. You can see previous sections below: Part 1 Part 2 In this ...