我UTC在 PostgreSQL 中设置了时区,并SELECT NOW()在控制台中显示了正确的日期psql。
我使用 PHPStorm 进行开发,并使用它的数据库控制台来访问我的数据库,但它使用不同的时区(欧洲/莫斯科,这是我的 Mac 的时区),并向SELECT NOW()我显示该时区的时间(顺便说一下,日期错误,因为欧洲/莫斯科时区最近将其偏移量更改为+3from +4)。
我还没有找到任何关于如何告诉 PHPStorm 使用配置的时区postgresql.conf而不是系统时区的信息。是否可以?
在我的应用程序中,有一个用例来查找与某个其他地理点最接近的点。我决定使用内存空间索引,并找到了几种候选对象:jeospatial和Lucene空间。
我做了一些基准测试,很惊讶地发现Lucene指数非常慢。这是使用JMH完成的基准测试代码。完整的源代码可以在我的GitHub存储库中找到。
@State(Scope.Thread)
public class MyBenchmark {
// Lucene
private static final String COORDINATES_FIELD = "coordinates";
private static final int GEO_PRECISION_LEVEL = 5;
private static final double NEARBY_RADIUS_DEGREE = DistanceUtils.dist2Degrees(
50, DistanceUtils.EARTH_MEAN_RADIUS_KM);
private final Directory directory = new RAMDirectory();
private final IndexWriterConfig iwConfig = new IndexWriterConfig();
private IndexWriter indexWriter = null;
private IndexSearcher indexSearcher = null;
private final SpatialContext spatialCxt = SpatialContext.GEO;
private final ShapeFactory shapeFactory = spatialCxt.getShapeFactory();
private final SpatialStrategy coordinatesStrategy …Run Code Online (Sandbox Code Playgroud)