![]() The information_schema.tables table in the system catalog contains the list of all tables and the schemas they belong to. ![]() ![]() example=# SELECT count_rows_of_table('northwind', 'orders') You can test the above function by passing in a table (for example, the orders table loaded from the Northwind dataset) as shown below. Select count(*) from "?schema"."?tablename" This function can subsequently be used in various types of queries to print the desired row counts in the various scenarios. Note that this function must be owned by a suitably privileged user, in our example we will use the yugabyte user. We’ll solve this problem by first creating a user defined function (UDF), count_rows_of_table which counts the number of rows in a single table. This means that the high-level approach to solving this problem is identical in the case of both PostgreSQL and YugabyteDB. Recall that YugabyteDB re-uses the native PostgreSQL codebase for its query layer (or the SQL processing layer) of the database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |