Posts

BigQuery - Data Encryption and Security

Image
With the cloud, Data encryption is no more a luxury but a necessity. BigQuery encrypts all your data at rest, encrypts all your data in transit. This tutorial will take a deep dive into BigQuery's encryption features Data Security Features in BigQuery Automatic data encryption by BigQuery using Google-managed keys. All communication and data transfer between clients and the server protected through TLS You can choose the geographical location where your data is stored, based on your cloud region Deployment inside a cloud platform VPC. Granular permission control using IAM (Identity and access management) What is End-to-End Encryption End-to-end encryption (E2EE) means the data is encrypted as it leaves the user till it gets loaded and vice versa. In Bigquery, this means that only a customer and the runtime components can read the data. No third parties, including Bigquery's cloud computing platform or any ISP, can see data in the clear 1. Data encryption at rest (i.e. on-disk e...

BigQuery Compression

  Google Bigquery Compression and Columnar Storage Overview BigQuery is a Columnar analytics database.  Behind the scenes, All the data is compressed by default in BigQuery. Although the data is compressed, Google will charge the customers for the uncompressed data size (for both storage and data scanned) How BigQuery stores the data internally With Columnar format, any column level analytical operations are going to be much faster. To understand the organization of data in Bigquery, we will need to get ourselves familiar with the below two concepts: Repetition level: the level of the repetitions in case of a repeat column type Definition level: Tells us whether the field been assigned a value or is it null For example: Consider the below table message Book { required string title, repeated string author, repeated group price { optional int64 discount, optional int64 usd, optional int64 eur, } } And consider we have three records in the table Book1: author: "AAA...

BigQuery Caching

Image
  What is BigQuery Caching ? When you execute a SQL in BigQuery the results are cached for 24 hours. If you happen to rerun the same query within the 24 hours, Results will be served from the cache (There is no charge for results served from cache). Caveat to note: Caching is offered at the user account level, which means the caching benefits are available only to you, If you teammate runs the same query, his query will not utilize your cache, it will scan the disk instead How does Caching work Internally ? Under the hood, whenever you execute a SQL, Once BigQuery completes the query processing and fetches the output result set, it automatically creates a temp table and stores the results in it. The next time you execute the same query, BigQuery will directly serve the results from the temp table. (There is no storage cost for the temp tables, and they will be automatically dropped after 24 hours) What happens to Cache results when the underlying data changes ? BigQuery Cache resul...

BigQuery Columnar Storage

Image
Understanding Google BigQuery Columnar Storage Architecture Traditional RDBMS systems use a Row-level storage - The entire row is stored together, so it can be retrieved.  A columnar database stores data by columns rather than by rows, which makes it suitable for analytical query processing, and thus for data warehouses BigQuery stores data in a proprietary columnar format called Capacitor, which has a number of benefits for data warehouse workloads.  Each column in the table is stored in a separate file block and all the columns are stored in a single capacitor file, which are compressed and encrypted on disk.  BigQuery dynamically uses query access patterns to determine the optimal number of physical shards Colossus - Google’s distributed file system The data persistence layer is provided by Google’s distributed file system, Colossus, where data is automatically compressed, encrypted, replicated, and distributed. Colossus ensures durability using erasure encoding t...

BigQuery Compute Engine (Slot)

Image
  Understanding Google BigQuery Compute Slots Bigquery uses Compute Slots to process your SQL Query and return the results. In this tutorial we will go through Bigquery slots in detail What is a BigQuery slot ? A BigQuery slot is a virtual CPU used by BigQuery to execute SQL queries. BigQuery automatically calculates how many slots are required by each query, depending on query size and complexity. There are two pricing models in Bigquery on-demand pricing and flat-rate pricing and the slot allocation differs in both. Lets take a detailed look Bigquery slot allocation for on-demand customers Customers with  On-demand pricing model (pay as you go) can get up to 2000 slots for processing their queries. The slots are allocated on demand (only when there is a need) and automatically de-allocated once the job is done. The customers only pay for the active usage milliseconds. One caveat here is the 2000 slots is not guaranteed. If the compute resouces are available in the shared poo...

Architeture of BigQuery

Image
  Google BigQuery Architecture and Concepts Google Bigquery has a unique Cloud Native architecture that allows for fast queries at petabyte scale using the distributed processing power of Google’s infrastructure.  Bigquery Architecture As you see in the above picture,  Storage and compute Layers are separated (decoupled) which allows them to scale independently on demand The Storage and compute layers are connected using a high speed network When a user submits a query, BigQuery will spin-up the compute on demand and then read the data from the distributed storage and fulfill the query. The decoupling of the storage and compute layers allows the compute layer to scale infinitely and support more queries and users This model also works for small and medium businesses customers as well Bigquery doesn't use the standard GCS buckets to store the data. It uses Colossus which is Google's proprietary storage system Now that we know the high level architecture, lets take a deep d...

Features of BigQuery

  Features of BigQuery Following are some of the useful features of BigQuery: 1. Fully Managed, Serverless Insight GCP that is Google cloud platform excels the industry in the ability to let you analyze data at the scale of the entire web, with the awareness of SQL and in a fully managed, serverless architecture where backend infrastructure is fully handled on behalf of you. One of the wonderful features of Google's big data analytics products is that they are able to scale automatically while you focus only on the business insight you want to uncover. 2. Fast Queries on Petabyte-scale Datasets BigQuery is Cloud Platform's fully managed data warehouse that lets you frugally query massive volumes of data at a speed which anyone would expect from Google. Google does not charge daily but you have to pay as you go. Google provides pricing benefits and the scalability and security of Google's best infrastructure to power your business insights. 3. Unified Batch and Stream Proces...