Build Applications from built-in sources?

Hi,

We have the problem, that queries from out go app to a postgres database are getting slower as more data exists. The strange thing is, that it is a significant difference even on tables with ~10 and the same in another database with ~400 rows. A simple “SELECT * FROM table LIMIT 1 OFFSET 0” takes 0.001 seconds on the smaller table but about 0.01 seconds on the larger one.

What we found out is that it is not about:

  • The database itself (Measured with the timing function in psql) - It takes in both cases about the same time
  • The postgres driver (lib/pg) -> I did an output here:
if len(args) == 0 {
	start := time.Now()
	r, err := cn.simpleQuery(query)
	log.Printf("TIME ELAPSED simpleQuery for query \"%s\": %v\n", query, time.Since(start))
	return r, err
}

Maybe this is the wrong way? But even though - The times in both cases are pretty much the same.

What it makes very hard to find out the problem, since it pops up ony on a couple of servers that don’t have Go installed at all.

So my next idea was to put some similar outputs into the sql package. Problem is appearently that for building the compiled sources are used.

So does anyone know how I can measure time at built-in packages in a compiled binary?

I solved it. You need to use the -a argument on go build.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.