Skip to content

Instantly share code, notes, and snippets.

View lolobosse's full-sized avatar

Lolobosse (old JN) lolobosse

View GitHub Profile
@lolobosse
lolobosse / legacy.sql
Created February 20, 2021 11:02
Legacy Query
SELECT data.id
FROM (select j1.id as id,
j1.title,
b1.company,
case
when active_job.location isnull
then :radius
when l1.location isnull
then :radius
else st_distance(l1.location, active_job.location) end as dist,
create materialized view similar_mv as (select j.id,
j.title,
j.source,
j.created_at,
j.updated_at,
j.category_id,
b2bt.company,
lt.location
from job_tb j
join b2b_tb b2bt on j.b2b_id = b2bt.id
SELECT data.id
FROM (select j1.id as id,
j1.title,
case
when active_job.location isnull
then :radius
when j1.location isnull
then :radius
else st_distance(j1.location, active_job.location) end as dist,
similarity(j1.title, active_job.title) as close,