PostgreSQL的可扩展性 [英] Extensibility on PostgreSQL

查看:366
本文介绍了PostgreSQL的可扩展性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了自己的R-tree:rtree.h

I created my own R-tree: "rtree.h"

我想在postgres中使用我自己的数据结构我阅读了有关将扩展连接到索引的信息,现在我正在阅读一些示例这里,但老实说,我不明白在所有如何使用我自己的R树来创建一个扩展性,我理解关于运算符,索引等的概念,但我不知道该怎么做。

I want to create an extension in postgres with my own data structure (Using PostGis), already I read about Interfacing Extensions To Indexes and now I'm reading some examples here, but to be honest, I don't get it at all how can I use my own R-Tree to create an Extensibility, I understand the concepts about operators, indexes, etc, But I don't know how to do it.


那么,我如何将我的文件连接到PostGis,然后在PostgreSQL上创建一个可扩展性?

So, How can I connect my file to PostGis and then create an extensibility on PostgreSQL?

因为可扩展性是函数,让我们在PostgreSQL的网站上举个例子:

Since the extensibilities are functions, let say the one example in PostgreSQL's website:

CREATE OR REPLACE FUNCTION my_consistent(internal, data_type, smallint, oid, internal)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C STRICT;




它是如何工作的? MODULE_PATHNAME等于/path/rtree.h?

How exactly it works? MODULE_PATHNAME is equal to /path/rtree.h?


推荐答案

一个用C语言写的函数,你必须首先编译对象,所以'MODULE PATHNAME'将会是 rtree.so 在Linux系统上,可能在Windows上的dll。函数目录中的代码此处提供了函数定义的大纲C和SQL函数来声明Postgres中的函数。

In terms of how to define a function written in C in postgres you have to compile the object first, so the 'MODULE PATHNAME' would be rtree.so on Linux systems and probably a dll on Windows. The code in the functions directory here provide an outline of the function definitions in C, and the SQL function to declare the function in Postgres.

在实现R-Tree方面,我将使用你已经发现。我不认为你只能编译你的 R-Tree.c 程序,它只是工作,你必须使用GIST结构。看起来像有曾经树实现在Postgres中继,你可以找到,或者你可以看看这个B树的gist扩展,在当前trunk: https://github.com/postgres/postgres/tree/master/contrib/btree_gist

In terms of how you would implement the R-Tree, I would use the GIST resource that you have already found. I don't think you can just compile your R-Tree.c program and it just work, you have to work with the GIST construct. It looks like there was once an r-tree implementation in the Postgres trunk that you may be able to find, or you could have a look at this B-tree gist extension which is in the current trunk: https://github.com/postgres/postgres/tree/master/contrib/btree_gist.

这篇关于PostgreSQL的可扩展性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆