<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Chexlow</title>
    <description>The latest articles on DEV Community by Chexlow (@chexlow).</description>
    <link>https://dev.to/chexlow</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4265830%2F0a8606bb-60f1-401e-bfe0-17eacc79bddc.png</url>
      <title>DEV Community: Chexlow</title>
      <link>https://dev.to/chexlow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chexlow"/>
    <language>en</language>
    <item>
      <title>How We Measure Real-Time Cross-Store Price Spreads Across 1,749 Products (Typesense + PostgreSQL)</title>
      <dc:creator>Chexlow</dc:creator>
      <pubDate>Thu, 26 Nov 2026 03:03:05 +0000</pubDate>
      <link>https://dev.to/chexlow/how-we-measure-real-time-cross-store-price-spreads-across-1749-products-typesense-postgresql-3ld</link>
      <guid>https://dev.to/chexlow/how-we-measure-real-time-cross-store-price-spreads-across-1749-products-typesense-postgresql-3ld</guid>
      <description>&lt;p&gt;Every online shopper has seen the same pair of sneakers or designer handbag sell for wildly different prices at different stores. When you run a multi-merchant comparison catalog, measuring how big that gap actually is sounds like a one-line &lt;code&gt;SELECT MAX(price) - MIN(price)&lt;/code&gt; query.&lt;/p&gt;

&lt;p&gt;In production, naive &lt;code&gt;MIN&lt;/code&gt;/&lt;code&gt;MAX&lt;/code&gt; queries lie. Here is how we built a two-stage Typesense + PostgreSQL pipeline at &lt;a href="https://chexlow.com" rel="noopener noreferrer"&gt;Chexlow&lt;/a&gt; to measure live cross-store price spreads across &lt;strong&gt;1,749 verified multi-store products&lt;/strong&gt; without N+1 database meltdowns or noisy variant spikes—and what the live data shows.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Live interactive report &amp;amp; dataset: &lt;a href="https://chexlow.com/research/price-spread" rel="noopener noreferrer"&gt;chexlow.com/research/price-spread&lt;/a&gt; | &lt;a href="https://github.com/chexlow/price-spread-benchmark" rel="noopener noreferrer"&gt;GitHub Benchmark Repo&lt;/a&gt; | &lt;a href="https://huggingface.co/datasets/mkan/chexlow-price-spread-benchmark" rel="noopener noreferrer"&gt;Hugging Face Dataset&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Why Naive &lt;code&gt;MIN(price)&lt;/code&gt; / &lt;code&gt;MAX(price)&lt;/code&gt; Breaks on Retail Feeds
&lt;/h2&gt;

&lt;p&gt;If you run raw &lt;code&gt;MIN&lt;/code&gt;/&lt;code&gt;MAX&lt;/code&gt; over an &lt;code&gt;offers&lt;/code&gt; table grouped by &lt;code&gt;product_id&lt;/code&gt;, three things immediately distort your numbers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Same-merchant variant pollution&lt;/strong&gt;: One retailer might list size XS at clearance ($120) and size L at full MSRP ($240). Comparing &lt;code&gt;MIN&lt;/code&gt; and &lt;code&gt;MAX&lt;/code&gt; across raw offer rows measures &lt;em&gt;within-store size clearance&lt;/em&gt;, not &lt;em&gt;cross-store pricing competition&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixed currencies and sale-price ratios&lt;/strong&gt;: A catalog spanning US, EU, and AU merchants mixes currencies unless sale prices are normalized consistently into USD alongside regular prices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feed mapping outliers&lt;/strong&gt;: Even with strict SKU matching, occasional bundle or accessory mismatches create &lt;code&gt;10x&lt;/code&gt; artificial price gaps that ruin mean averages.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Two-Stage Architecture: Typesense Scan + Single-Roundtrip PostgreSQL
&lt;/h2&gt;

&lt;p&gt;Rather than running an expensive full-table aggregation across millions of offer rows on every request, we split discovery and aggregation into two focused stages inside &lt;code&gt;GET /api/v1/catalog/discovery/price-spread-report&lt;/code&gt;:&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 1: Public-Gate Filtering in Typesense
&lt;/h3&gt;

&lt;p&gt;First, we page through Typesense (&lt;code&gt;per_page=250&lt;/code&gt;, capped at 20 pages / 5,000 candidates) using the exact same public indexability rules that govern our storefront pages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;seo_owner:=chexlow&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;status:=active&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;offer_count:&amp;gt;0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;store_count:&amp;gt;=3&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;category_slug:!=uncategorized&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guarantees we only inspect products that actually exist as live comparison pages with offers from at least three merchants.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 2: Single-Roundtrip Per-Merchant Aggregation in PostgreSQL
&lt;/h3&gt;

&lt;p&gt;Next, we pass the matched product UUID array to PostgreSQL in a single parameterized &lt;code&gt;unnest($1::uuid[])&lt;/code&gt; query. Inside a CTE, we first collapse every product-merchant pair down to that merchant's &lt;strong&gt;single lowest effective USD offer&lt;/strong&gt;, preserving consistent currency conversion and sale pricing, then filter for &lt;code&gt;COUNT(DISTINCT merchant_id) &amp;gt;= 3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Once PostgreSQL returns one &lt;code&gt;(lowest_price_usd, highest_price_usd, ordered_merchants)&lt;/code&gt; row per product:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Items where &lt;code&gt;highest / lowest &amp;gt; 4&lt;/code&gt; are excluded as conservative outlier protection (excluding &lt;strong&gt;11&lt;/strong&gt; items in our &lt;code&gt;2026-11-26&lt;/code&gt; snapshot).&lt;/li&gt;
&lt;li&gt;Results are cached in &lt;strong&gt;Redis&lt;/strong&gt; for 30 minutes and served behind &lt;strong&gt;Cloudflare&lt;/strong&gt; &lt;code&gt;stale-while-revalidate=600&lt;/code&gt;, bringing warm API responses down to ~&lt;code&gt;0.37s&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What 1,749 Multi-Store Products Actually Show (&lt;code&gt;2026-11-26&lt;/code&gt; Snapshot)
&lt;/h2&gt;

&lt;p&gt;Across our live snapshot (&lt;code&gt;observedAt: 2026-11-26T02:54:21.100Z&lt;/code&gt;, &lt;strong&gt;30 verified merchants&lt;/strong&gt;, &lt;strong&gt;273 brands&lt;/strong&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;96.3% (&lt;code&gt;1,684&lt;/code&gt; of &lt;code&gt;1,749&lt;/code&gt; products)&lt;/strong&gt; have a real price difference across stores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Median spread&lt;/strong&gt;: &lt;strong&gt;22.3% (&lt;code&gt;$72.37 USD&lt;/code&gt;)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Average spread&lt;/strong&gt;: &lt;strong&gt;23.6% (&lt;code&gt;$147.20 USD&lt;/code&gt;)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Category Divergence: Fragrances vs. Skincare
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Products&lt;/th&gt;
&lt;th&gt;Average Spread&lt;/th&gt;
&lt;th&gt;Median Spread&lt;/th&gt;
&lt;th&gt;Median Savings (USD)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Women's Clothing&lt;/td&gt;
&lt;td&gt;314&lt;/td&gt;
&lt;td&gt;25.1%&lt;/td&gt;
&lt;td&gt;22.3%&lt;/td&gt;
&lt;td&gt;$108.37&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Handbags&lt;/td&gt;
&lt;td&gt;207&lt;/td&gt;
&lt;td&gt;25.7%&lt;/td&gt;
&lt;td&gt;24.8%&lt;/td&gt;
&lt;td&gt;$179.77&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Men's Clothing&lt;/td&gt;
&lt;td&gt;203&lt;/td&gt;
&lt;td&gt;26.4%&lt;/td&gt;
&lt;td&gt;25.2%&lt;/td&gt;
&lt;td&gt;$107.85&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fashion&lt;/td&gt;
&lt;td&gt;185&lt;/td&gt;
&lt;td&gt;24.9%&lt;/td&gt;
&lt;td&gt;23.4%&lt;/td&gt;
&lt;td&gt;$87.91&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Women's Shoes&lt;/td&gt;
&lt;td&gt;179&lt;/td&gt;
&lt;td&gt;25.5%&lt;/td&gt;
&lt;td&gt;22.8%&lt;/td&gt;
&lt;td&gt;$100.40&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Men's Shoes&lt;/td&gt;
&lt;td&gt;109&lt;/td&gt;
&lt;td&gt;27.1%&lt;/td&gt;
&lt;td&gt;26.9%&lt;/td&gt;
&lt;td&gt;$77.78&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Fragrances&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;57&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32.8%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;33.3%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$53.64&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Skincare&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;50&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;11.7%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.4%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$2.54&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Moisturizers&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;49&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.4%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$2.89&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hair Styling&lt;/td&gt;
&lt;td&gt;28&lt;/td&gt;
&lt;td&gt;20.2%&lt;/td&gt;
&lt;td&gt;13.5%&lt;/td&gt;
&lt;td&gt;$6.50&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;While &lt;strong&gt;Skincare (&lt;code&gt;3.4%&lt;/code&gt; median)&lt;/strong&gt; and &lt;strong&gt;Moisturizers (&lt;code&gt;3.4%&lt;/code&gt; median)&lt;/strong&gt; exhibit tight price parity across retailers, &lt;strong&gt;Fragrances (&lt;code&gt;33.3%&lt;/code&gt; median)&lt;/strong&gt; vary almost &lt;strong&gt;10x&lt;/strong&gt; as much between stores. Meanwhile, &lt;strong&gt;Handbags&lt;/strong&gt; combine a &lt;code&gt;24.8%&lt;/code&gt; median gap with &lt;code&gt;$179.77 USD&lt;/code&gt; median dollar savings (&lt;code&gt;$283.44 USD&lt;/code&gt; average).&lt;/p&gt;

&lt;h3&gt;
  
  
  Brand &amp;amp; Item Examples
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diesel&lt;/strong&gt; (&lt;code&gt;32&lt;/code&gt; items): &lt;code&gt;36.8%&lt;/code&gt; median (&lt;code&gt;39.7%&lt;/code&gt; avg, &lt;code&gt;$231.44&lt;/code&gt; avg savings)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gucci&lt;/strong&gt; (&lt;code&gt;27&lt;/code&gt; items): &lt;code&gt;36.8%&lt;/code&gt; median (&lt;code&gt;27.1%&lt;/code&gt; avg, &lt;code&gt;$332.34&lt;/code&gt; avg savings)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New Balance&lt;/strong&gt; (&lt;code&gt;27&lt;/code&gt; items): &lt;code&gt;33.6%&lt;/code&gt; median (&lt;code&gt;36.7%&lt;/code&gt; avg, &lt;code&gt;$73.57&lt;/code&gt; avg savings) — e.g., &lt;code&gt;New Balance 9060 Sneakers in Nubuck and Mesh&lt;/code&gt; across 5 stores at &lt;code&gt;$155.25&lt;/code&gt; to &lt;code&gt;$238.00 USD&lt;/code&gt; (&lt;code&gt;34.8%&lt;/code&gt; spread)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adidas&lt;/strong&gt; (&lt;code&gt;65&lt;/code&gt; items): &lt;code&gt;30.0%&lt;/code&gt; median (&lt;code&gt;34.7%&lt;/code&gt; avg) vs. &lt;strong&gt;Nike&lt;/strong&gt; (&lt;code&gt;48&lt;/code&gt; items): &lt;code&gt;17.5%&lt;/code&gt; median (&lt;code&gt;18.1%&lt;/code&gt; avg)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UGG Tasman II Suede Sabot Mules&lt;/strong&gt;: &lt;code&gt;$104.95&lt;/code&gt; to &lt;code&gt;$208.80 USD&lt;/code&gt; across 7 verified stores (&lt;code&gt;49.7%&lt;/code&gt; spread / &lt;code&gt;$103.85 USD&lt;/code&gt; difference)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pinko Love Classic Puff Classic Bag&lt;/strong&gt;: &lt;code&gt;$243.03&lt;/code&gt; to &lt;code&gt;$547.55 USD&lt;/code&gt; across 5 stores (&lt;code&gt;55.6%&lt;/code&gt; spread / &lt;code&gt;$304.52 USD&lt;/code&gt; difference)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Open Data, API, and MCP Access
&lt;/h2&gt;

&lt;p&gt;Everything in this benchmark is publicly inspectable without an API key or login:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Report Page&lt;/strong&gt;: &lt;a href="https://chexlow.com/research/price-spread" rel="noopener noreferrer"&gt;https://chexlow.com/research/price-spread&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSON Endpoint&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;  curl -sS &lt;span class="s2"&gt;"https://api.chexlow.com/api/v1/catalog/discovery/price-spread-report?siteDomain=chexlow&amp;amp;minStoreCount=3"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hugging Face Dataset (&lt;code&gt;CC-BY-4.0&lt;/code&gt;)&lt;/strong&gt;: &lt;a href="https://huggingface.co/datasets/mkan/chexlow-price-spread-benchmark" rel="noopener noreferrer"&gt;mkan/chexlow-price-spread-benchmark&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;  &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datasets&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;load_dataset&lt;/span&gt;
  &lt;span class="n"&gt;ds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load_dataset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"mkan/chexlow-price-spread-benchmark"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"categories"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"train"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Benchmark Repo&lt;/strong&gt;: &lt;a href="https://github.com/chexlow/price-spread-benchmark" rel="noopener noreferrer"&gt;chexlow/price-spread-benchmark&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer Docs, OpenAPI &amp;amp; Remote MCP Server&lt;/strong&gt;: &lt;a href="https://chexlow.com/developers" rel="noopener noreferrer"&gt;chexlow.com/developers&lt;/a&gt; (&lt;code&gt;https://chexlow.com/mcp&lt;/code&gt;, &lt;code&gt;https://chexlow.com/openapi.json&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you use the CSV snapshots or build pricing models on top of this benchmark, let us know what patterns you spot!&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>opendata</category>
    </item>
  </channel>
</rss>
