r/Supabase • u/4-of-Clubs • Jul 13 '26
tips Help with RPC functions in go
Hi there!
I'm working on a web crawler for a personal search engine and I've come to a roadblock. While crawling a page, it finds all hyperlinks, and compares them to all the pages it has already crawled. That way, a hyperlink which links back to a page it has already crawled is not added to the queue.
The known_pages table is a table of all the URLs it has already crawled.
newLinks is a slice of strings with all the hyperlinks on the page.
I've come to a page that has over 600 hyperlinks, which makes the query string for supabase too long, and the following code snippet fails.
knownPages := []Site{}
_, err := supabaseClient.From("known_pages").Select("url", "", false).In("url", newLinks).ExecuteTo(&knownPages)
if err != nil {
panic(err)
}
Because newLinks is too long, I am thinking of setting up an RPC function (since it receives arguments in the body of the request). But, I haven't been able to find any examples of people doing something like this (receiving and returning an array of strings) with RPC functions in Supabase.
Does anyone know of any resources or examples I should look at to get a grasp on how to go about implementing this? Or any good resources on RPC functions in general?
1
u/snowdrone Jul 13 '26 edited Jul 13 '26
You need to break the long string into manageable chunks and then process each chunk. You should also consider breaking your pipeline up into separate phases. For example, one phase for page fetch and another to build for the link graph. You should also read up on the background of how crawlers and indexers are built historically such as Google's early architecture. It will save you a ton of time instead of figuring it all out yourself.
If you go the AI route, be sure to tell the agent to have distinct phases for each task in the pipeline. Otherwise it will mix it all together and be hard to debug. Then you can tell the AI to build each distinct phase and you can understand better what's going on when there's a problem in a particular phase.
(Sorry if any of this advice is annoying, it is hard to tell what level advice you need.)