ClickHouse億點抽樣展示

2022-06-25 13:24:11 字數 942 閱讀 3487

資料來源 (點資料使用之前匯入的資料120038310條,

create table default.points

( `id` uint32,

`lon` float32,

`lat` float32

)engine = mergetree()

order by (inthash64(id), lon, lat)

sample by inthash64(id)

settings index_granularity = 8192

insert into points select id,lon,lat from pnts

sample 子句特點

該 sample 子句允許近似於 select 查詢處理。

啟用資料取樣時,不會對所有資料執行查詢,而只對特定部分資料(樣本)執行查詢。 例如,如果您需要計算所有訪問的統計資訊,只需對所有訪問的1/10分數執行查詢,然後將結果乘以10即可。

近似查詢處理在以下情況下可能很有用:

當你有嚴格的時間需求(如<100ms),但你不能通過額外的硬體資源來滿足他們的成本。

當您的原始資料不準確時,所以近似不會明顯降低質量。

業務需求的目標是近似結果(為了成本效益,或者向高階使用者推銷確切結果)。

hash函式inthash64可以用於將元素不可逆的偽隨機打亂。經過測試一億多個點得抽樣效能比較滿意,可以為頁面提供比較滿意得展示。注意事項:sample的字段必須是int型別,必須在主鍵或者排序中。

抽樣sql,0.01為示例,可根據實際修改

select id,lon,lat from points sample 0.01
使用express作為服務端,請求資料並且在網頁中使用maptalks展示,本地測試

測量展點lisp lisp展點程式問題

defunc zd setvar pdmode 1 setvar pdsize 1.0000 setqfn getfiled nselectafile c users desktop 等高線 txt 16 setqf openfn r setqd read linef while d 000 def...

ClickHouse常用知識點

root hadoop102 yum install y libtool root hadoop102 yum install y unixodbc 官網 1 root hadoop102 software ls 2 clickhouse client 1.1.54236 4.el6.x86 64....

cad展點外掛程式lisp使用 LISP快速展點程式

一 展點程式載入 在auto cad中加lisp程式的兩種簡單方法 1 使用load函式載入 在命令列中鍵入以函式回車即可載入 load d abc jgl kszd.lsp 2 使用選單載入 工具 t 載入應用程式 l 在選擇檔案對話方塊中選 d abc jgl kszd.lsp 載入 l 關閉 ...