A BigQuery data warehouse for ecommerce works best with three layers: raw tables that copy each source system untouched, a cleaned layer where orders, products, customers, costs and ad spend are joined on shared keys, and a small set of reporting tables that finance and marketing both read. Most ecommerce teams get stuck not on BigQuery itself but on the middle layer, where definitions such as "revenue" and "profit" are decided once.

This article lays out that reference architecture, the tables each layer needs, what BigQuery costs to run and the mistakes we see most often in retail projects.

What does an ecommerce data warehouse have to answer?

It has to answer one question reliably: what is left of each order after goods, ads, delivery and payments, by product, market and campaign. Everything else (traffic, stock, customer cohorts) is a side question that reuses the same tables.

That goal decides the design. You need every source that touches an order: the shop platform, the ad platforms, delivery and payment providers, the ERP or accounting system for product costs, and web analytics. If one of them is missing, the profit number is wrong in a way nobody can see.

What does the three-layer layout look like?

Layer What it holds Who reads it
Raw One dataset per source, loaded as delivered, never edited Data engineers only
Clean Orders, order lines, products, customers, costs, ad spend with shared keys and one currency Analysts, AI tools
Reporting Daily tables such as profit by order, product, market and campaign Finance, marketing, management

The rule that keeps this healthy: raw is append-only, clean is rebuilt from raw, reporting is rebuilt from clean. When a number is wrong you fix the logic and rebuild, instead of patching data by hand.

Keep one dataset per layer and per source in raw (for example raw_shop, raw_ads, raw_ga4), then clean and reporting. Naming is boring, and that is the point: a new analyst should find the order table in under a minute.

Which sources should land in BigQuery first?

Start with the sources that carry money, in this order:

  1. Shop orders and order lines, including discounts, refunds and returns.
  2. Product costs from your ERP or a maintained cost sheet. Without it you have revenue, not profit.
  3. Ad spend from Google Ads and Meta, at campaign and day level.
  4. Delivery and payment costs, usually from monthly invoices and payout reports.
  5. Web analytics. Google Analytics 4 has a built-in BigQuery export that creates a daily events_YYYYMMDD table with raw, unsampled events, and an optional streaming events_intraday table for the current day, according to Google's GA4 documentation. Standard properties have a daily export limit of 1 million events, so check your traffic against it.

Google also recommends querying the daily table rather than the intraday one, because streaming export is best-effort and can have gaps. For profit reporting, use the daily table.

How do you model the clean layer?

Model around the order. A minimal retail model has these tables:

  • orders and order_lines: one row per order and per item, with price excluding VAT.
  • products: product, category, current and historical cost.
  • customers: identifier, first order date, country.
  • ad_spend: day, platform, campaign, cost, clicks.
  • fulfilment_costs: delivery, return delivery and payment fee, allocated to orders.
  • fx_rates: one rate per currency and day.

Three decisions belong in this layer and nowhere else. First, one currency and one VAT rule: store net amounts in your reporting currency, with the original currency kept alongside. Second, one definition of a returned order: say how long you wait for returns before an order counts as final. Third, one key per customer and per product across shop, ERP and analytics.

When these are decided in the clean layer, the dashboards, the finance export and any AI tool read the same number. When they are decided in each report, you get two numbers for the same thing, which is the usual complaint we hear from teams without a warehouse layer.

What does a worked cost example look like?

BigQuery bills storage and query processing separately. For queries, Google's pricing page lists an on-demand rate of $6.25 per TiB processed, with the first 1 TiB per month free; check the page for your region before you budget.

Take a mid-size shop with a clean layer that holds 50 GiB of tables. A reporting refresh that scans the whole clean layer once a day processes 50 GiB × 30 days = 1,500 GiB, about 1.46 TiB a month. After the free 1 TiB, 0.46 TiB × $6.25 ≈ $2.9. Add analysts' ad-hoc queries and it is still a small bill.

This example is illustrative, not a client figure. The bill grows when queries scan far more than they need, which is where table design matters.

How do you keep the BigQuery bill small?

Google's own guidance gives three levers:

  • Partition by date. A partitioned table is divided into segments by one column, and a query that filters on that column skips the other partitions, which cuts bytes read, according to the partitioning documentation. A table can have up to 10,000 partitions, so daily partitions cover decades.
  • Select only the columns you need. BigQuery stores data by column and charges for the columns you select, even when you add LIMIT, per the pricing page. SELECT * on a wide events table is the classic expensive mistake.
  • Set a cap. The cost-optimisation guidance recommends the maximum-bytes-billed setting, which stops a query before it runs if it would exceed your limit, and custom daily quotas.

Also use a dry run before heavy queries: it shows the bytes a query would process without charging for it. Google notes the estimate is an upper bound.

What are the common mistakes?

  • Loading everything, modelling nothing. A warehouse with raw tables only is a pile of exports. Reports then recompute definitions each time.
  • Cost data missing. Revenue-only warehouses cannot answer profit questions. Add product costs before you add a tenth dashboard.
  • Monthly costs ignored. Delivery invoices arrive monthly and returns weeks later. Design for restating yesterday's numbers; otherwise the daily figure and the month-end close never match.
  • No owner for definitions. Someone in finance must sign off what "profit" means, or the warehouse inherits the disagreement.
  • Dashboards connected to raw tables. Point tools at the reporting layer, so a definition changes in one place.

When should you build it yourself and when not?

Build it yourself if you have a data engineer who will maintain pipelines, monitor loads and own definitions. The first version is a few weeks of work; the maintenance is the real cost, because APIs change and invoices arrive late.

If you do not have that person, buy the layer rather than the tool: a packaged model with the connectors and the profit logic already built. That is what we built the Retail Automation Suite for, and the data engineering page shows how we approach warehouse design on Google Cloud and other platforms. To see what your own numbers would show before committing to anything, start with the free margin audit.

For the next step after the warehouse, see how to let Claude or ChatGPT query your BigQuery retail data, and for the formula the reporting layer should compute, how to calculate profit per order.

FAQ

Is BigQuery a good data warehouse for ecommerce?

Yes, for most ecommerce companies. It is serverless, so you do not manage servers, it has a built-in export from Google Analytics 4, and you pay for what you query. Its weak point is not technical: it holds whatever you load, so the value depends on the modelling layer you build on top.

How much does a BigQuery data warehouse cost?

Storage and queries are billed separately. On-demand queries are listed at $6.25 per TiB processed with the first 1 TiB per month free, so a small shop with a clean layer of tens of gigabytes often pays little. Pipelines, tools and the engineering time to run them usually cost more than BigQuery itself.

Do I need a data warehouse if I only use Shopify and Google Analytics?

Not necessarily to start. A warehouse pays off when you need to combine sources, for example orders, ad spend, product costs and delivery fees, into one profit number. If one platform already answers your questions, wait until it stops doing so.

Should I use BigQuery or Snowflake for ecommerce?

Choose the one your team and tools already work with. For teams on GA4, BigQuery has the shortest path, because GA4 exports to it directly. The architecture above works the same on either; the layers matter more than the engine.

How long does it take to set up?

A first version covering orders, product costs, ad spend and one reporting table takes a few weeks with a dedicated engineer. Adding delivery, payments and returns correctly takes longer, because their data arrives late and in different formats.

Sources