Daily Shaarli

All links of one day in a single page.

October 26, 2023

Introducing runes
thumbnail

In 2019, Svelte 3 turned JavaScript into a reactive language. Svelte is a web UI framework that uses a compiler to turn declarative component code

Runes are symbols that influence the Svelte compiler. Whereas Svelte today uses let, =, the export keyword and the $: label to mean specific things, runes use function syntax to achieve the same things and more.

巧用 array 處理 tags - HackMD
thumbnail

該網頁介紹了在 PostgreSQL 中使用 array 處理 tags 的方法。首先說明傳統方法,建立三個表格用於存儲標籤、視頻和視頻標籤關係,然後提供了使用 array 的方法,這方法只需建立兩個表格,將視頻標籤關係表格合併到視頻表格,以精簡查詢並提高效率​。

該文章中提到的 array 類型和 array_agg() 函數,以及 @> (包含)運算符和 unnest() 函數,都是 PostgreSQL 特有的功能。這些功能允許用戶以更高效和簡潔的方式處理和查詢含有標籤的資料​。

GIN(Generalized Inverted Index)是 PostgreSQL 中提供的一種索引類型,專為處理包含多值元素(例如陣列)的列而設計。它可以快速地處理包含、相等和其他陣列相關的操作,這在處理大型多值資料時非常有用。在該文章中,GIN 索引被用來加速對陣列列的查詢操作​。