TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Multiranges in Postgres

139 pointsby gurjeetover 2 years ago

9 comments

darksaintsover 2 years ago
Just want to throw out the usefulness of multiranges in my current domain, which is spectrum regulation/licensing. A few of our processes enabled by multirange support have caught serious exclusivity conflicts (where there are more than one licensee with exclusive rights to a specific span of spectrum within a specific geographic area) with licenses that were not caught by the FCC before they were issued. Additionally useful for swaps (where licensees trade licenses to improve their holdings relative to their existing portfolio)...multiranges allow for easy and error free analysis of potential swap targets that maximize benefit to both parties. And we also use it for spot checks to make sure that we are using spectrum legally according to the special conditions constraints (e.g. not using 600MHz A block within a distance that could cause interference with hospital usage of WMTS equipment). I love range types!
评论 #33360045 未加载
thomover 2 years ago
It’s also worth knowing that you can accelerate many sorts of range queries with a GIST index. This often ends up faster than using two separate columns.
评论 #33358966 未加载
评论 #33357176 未加载
afhammadover 2 years ago
I&#x27;ve used tsrange successfully in 2 projects to optimise storage of temporal data. The same can be achieved with start&#x2F;end timestamp columns at the cost of more complex and error prone queries.<p>Multiranges <i>could</i> be used to further optimise for storage of duplicate data (if a data pattern repeats at different intervals) but it&#x27;s not a big enough margin for me yet.
ainar-gover 2 years ago
I really like PostgreSQL ranges, but I&#x27;ve always been curious, if these are an extension or they are a part of the SQL standard? The “Range Types” page[1] doesn&#x27;t seem to mention the standard at all, and appendix D.1, “Supported Features”, doesn&#x27;t mention range types.<p>The reason I&#x27;m curious is because may future SQL database implementations will most likely use the standard at least in some capacity, so it&#x27;d be nice to know, how future-proof and DBMS-switch-proof a schema using these could be.<p>[1]: <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;rangetypes.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;rangetypes.html</a><p>[2]: <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;features-sql-standard.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;features-sql-standar...</a>
评论 #33356649 未加载
评论 #33355567 未加载
pjungwirover 2 years ago
I&#x27;m still hoping to use multiranges to add temporal tables to Postgres, but life has been busy the last year. I apologize to you all for the delay.<p>The coolest application of multiranges I&#x27;ve heard about is for astronomical observations. The authors of this paper were kind enough to share an early draft with me, and they say it greatly speeds up comparisons of sky objects. It&#x27;s very accessible and a fun read:<p><a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2112.06947" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2112.06947</a>
timwisover 2 years ago
Wow, I was just trying to solve the problem of merging overlapping periods in ruby. Life would be so much easier if the database did it for me!
评论 #33355267 未加载
评论 #33382939 未加载
评论 #33354519 未加载
kortexover 2 years ago
Is there a name for the ` &lt;@ ` operator? Been calling it the tornado operator but I haven&#x27;t found anything indicating an &quot;official&quot; name.
评论 #33362376 未加载
stuaxoover 2 years ago
This is really useful, I&#x27;ve been doing something like this manually.<p>What&#x27;s the performance like to get multiranges from a million row column of unique integers, that has a few gaps in it.<p>(Also <i>slightly</i> unsorted, but obv can do that in query).
collinc777over 2 years ago
I wonder if I can use this for Calendar event systems with recurring events in perpetuity.