When an authenticated user, whom has never visited a site collection, first visits a site there are a number of tables within the Content database which must be updated.
The SharePoint Content database’s UserInfo table stores user specific information about an authenticated user and this information and really acts as a cache which is updated periodically. When a first time user first visits a site this table must be populated. There is a row for each user and for each site collection for which they have visited. For example, if you have 100 site collections and 50 users have visited 50 of the site collections there will be 50*50 or 2,500 approximately rows in the UserInfo table.
Its not just the UserInfo table which gets updated when a new user visits a site collection for the first time but rather a whole host of tables.
•UserInfo – Insert one row for new user
•AllListsAux – Update the item count for the user list
•AllDocs – Update the Last Modified Time and Item Count for the _catalogs/users
•AllSites – Update the NextUserOrGroupdId, LastContentChanged and DiskUsed (quota management)
•AllUserData – Insert a new row
•EventCache – Insert two new rows into this table to track the updates to the site collection and the site collection’s root web
•StorageMetrics – Insert a new row
•StorageMetricsChanges – Update one row
So as you can see when a new user visits a SharePoint site collection for the first time we INSERT into 5 tables and UPDATE 4 tables.
you can use powershell script to get the Information from the UserInfo Table, if the user has an entry in the list for a particular site collection, it indicates that he has visited that particular site collection.
UserInfo Table, check this to know more about the UserInfo table in SharePoint content database.
To access SharePoint content database using powershell, you can check this link