How does the Google search engine goes through the over 30 trillion web pages on the internet and find the top 10 results in just half a second, on average?
Google doesn’t actually visit every page on the internet every time you ask it something. Google stores information about web pages in databases (table of information, like in Excel), and it uses algorithms that read those databases to decide what to show you.
Crawl all web pages
Google’s algorithms build a database of every webpage on the internet. Google uses programs called spiders to “crawl” over web pages until it finds all of them. The spiders start on a few web pages and add those to Google’s list of pages, called “index”. Then, the spiders follow all the outgoing links on those pages and find a new set of pages, which they add to the index. Next, they follow all the links on those pages, and so on, until Google can’t find anything else.
Word search
If you search Google, it grabs your query (the text you typed into the search bar) and looks through its index to find the web pages that are most relevant.
Google uses keyword density to show the most frequently used words on the current page, then find the page that had the most matches.
Page rank
PageRank (PR) is an algorithm used by Google Search to rank web pages in their search engine results. It is named after both the term “web page” and co-founder Larry Page. According to Google:
PageRank works by counting the number and quality of links to a page to determine a rough estimate of how important the website is. The underlying assumption is that more important websites are likely to receive more links from other websites.
For instance, at a party, you know someone is popular when they’re surrounded by other popular people. PageRank gives each web page a score that’s based on the PageRank scores of every other page that links to that page.
SEO
SEO (Search engine optimization) is the process of improving the quality and quantity of website traffic to a website or a web page from search engines. The most basic form of SEO is getting more pages linked to your page. SEO also includes plenty more techniques, such as putting the right keywords in your page’s title and headings or making all of your site’s pages link to each other.