如何从当前时间PostgreSQL获取已创建或更新的数据30秒

时间:2016-06-03 19:16:19

标签: sql database postgresql elasticsearch node-postgres

我尝试从当前时间30秒开始创建或更新数据的表中访问数据。有没有人对如何有效地做到这一点有任何好的想法?我在npm中使用node.js和pg包。我想获取新创建/更新的数据以与elasticsearch同步。

1 个答案:

答案 0 :(得分:3)

30秒前创建完全的行:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <!-- Putt all your view here -->

        </LinearLayout>
    </ScrollView>

30秒前和现在之间创建的行:

select *
from the_table
where createdat = current_timestamp - interval '30' second