Pike v8.1 release 6

Method Postgres.postgres()->big_query()


Method big_query

Sql.postgres_result big_query(string sqlquery)
Sql.postgres_result big_query(string sqlquery, array bindings)

Description

This is the only provided interface which allows you to query the database. If you wish to use the simpler "query" function, you need to use the Sql.Sql generic sql-object.

It returns a postgres_result object (which conforms to the Sql.sql_result standard interface for accessing data). I recommend using query() for simpler queries (because it is easier to handle, but stores all the result in memory), and big_query for queries you expect to return huge amounts of data (it's harder to handle, but fectches results on demand).

Note

This function can raise exceptions.

The program Sql.postgres_result is a superset of the raw Postgres.postgres_result which does not do chunking to avoid excessive memory usage in case of large resultsets.

See also

Sql.Sql, Sql.sql_result