PostgreSQL: Table creation time
up vote
33
down vote
favorite
How can I find the table creation time in Postgresql.
Example ,
If I created a file I can find the file creation time like that I want to know the table creation time.
postgresql
add a comment |
up vote
33
down vote
favorite
How can I find the table creation time in Postgresql.
Example ,
If I created a file I can find the file creation time like that I want to know the table creation time.
postgresql
add a comment |
up vote
33
down vote
favorite
up vote
33
down vote
favorite
How can I find the table creation time in Postgresql.
Example ,
If I created a file I can find the file creation time like that I want to know the table creation time.
postgresql
How can I find the table creation time in Postgresql.
Example ,
If I created a file I can find the file creation time like that I want to know the table creation time.
postgresql
postgresql
edited Apr 5 '10 at 11:31
Milen A. Radev
42.8k169094
42.8k169094
asked Apr 5 '10 at 6:20
kiruthika
92462031
92462031
add a comment |
add a comment |
7 Answers
7
active
oldest
votes
up vote
14
down vote
accepted
I had a look through the pg_* tables, and I couldn't find any creation times in there. It's possible to locate the table files, but then on Linux you can't get file creation time. So I think the answer is that you can only find this information on Windows, using the following steps:
- get the database id with
select datname, datdba from pg_database;
- get the table filenode id with
select relname, relfilenode from pg_class;
- find the table file and look up its creation time; I think the location should be something like
<PostgreSQL folder>/main/base/<database id>/<table filenode id>
(not sure what it is on Windows).
4
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
|
show 1 more comment
up vote
17
down vote
You can't - the information isn't recorded anywhere. Looking at the table files won't necessarily give you the right information - there are table operations that will create a new file for you, in which case the date would reset.
add a comment |
up vote
2
down vote
I don't think it's possible from within PostgreSQL, but you'll probably find it in the underlying table file's creation time.
add a comment |
up vote
0
down vote
Suggested here :
SELECT oid FROM pg_database WHERE datname = 'mydb';
Then (assuming the oid
is 12345) :
ls -l $PGDATA/base/12345/PG_VERSION
This workaround assumes that PG_VERSION
is the least likely to be modified after the creation.
NB : If PGDATA
is not defined, check Where does PostgreSQL store the database?
add a comment |
up vote
0
down vote
I'm trying to follow a different way for obtain this.
Starting from this discussion my solution was:
DROP TABLE IF EXISTS t_create_history CASCADE;
CREATE TABLE t_create_history (
gid serial primary key,
object_type varchar(20),
schema_name varchar(50),
object_identity varchar(200),
creation_date timestamp without time zone
);
--delete event trigger before dropping function
DROP EVENT TRIGGER IF EXISTS t_create_history_trigger;
--create history function
DROP FUNCTION IF EXISTS public.t_create_history_func();
CREATE OR REPLACE FUNCTION t_create_history_func()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands () WHERE command_tag in ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
LOOP
INSERT INTO public.t_create_history (object_type, schema_name, object_identity, creation_date) SELECT obj.object_type, obj.schema_name, obj.object_identity, now();
END LOOP;
END;
$$;
--ALTER EVENT TRIGGER t_create_history_trigger DISABLE;
--DROP EVENT TRIGGER t_create_history_trigger;
CREATE EVENT TRIGGER t_create_history_trigger ON ddl_command_end
WHEN TAG IN ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
EXECUTE PROCEDURE t_create_history_func();
In this way you obtain a table that records all the creation tables.
add a comment |
up vote
-3
down vote
You can get this from pg_stat_last_operation. Here is how to do it:
select * from pg_stat_last_operation where objid = 'table_name'::regclass order by statime;
This table stores following operations:
select distinct staactionname from pg_stat_last_operation;
staactionname
---------------
ALTER
ANALYZE
CREATE
PARTITION
PRIVILEGE
VACUUM
(6 rows)
5
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
3
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
Tablepg_stat_all_tables
could also help.
– Hans Ginzel
Jun 15 '15 at 8:12
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
up vote
-3
down vote
--query
select pslo.stasubtype, pc.relname, pslo.statime
from pg_stat_last_operation pslo
join pg_class pc on(pc.relfilenode = pslo.objid)
and pslo.staactionname = 'CREATE'
Order By pslo.statime desc
will help to accomplish desired results
(tried it on greenplum)
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
14
down vote
accepted
I had a look through the pg_* tables, and I couldn't find any creation times in there. It's possible to locate the table files, but then on Linux you can't get file creation time. So I think the answer is that you can only find this information on Windows, using the following steps:
- get the database id with
select datname, datdba from pg_database;
- get the table filenode id with
select relname, relfilenode from pg_class;
- find the table file and look up its creation time; I think the location should be something like
<PostgreSQL folder>/main/base/<database id>/<table filenode id>
(not sure what it is on Windows).
4
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
|
show 1 more comment
up vote
14
down vote
accepted
I had a look through the pg_* tables, and I couldn't find any creation times in there. It's possible to locate the table files, but then on Linux you can't get file creation time. So I think the answer is that you can only find this information on Windows, using the following steps:
- get the database id with
select datname, datdba from pg_database;
- get the table filenode id with
select relname, relfilenode from pg_class;
- find the table file and look up its creation time; I think the location should be something like
<PostgreSQL folder>/main/base/<database id>/<table filenode id>
(not sure what it is on Windows).
4
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
|
show 1 more comment
up vote
14
down vote
accepted
up vote
14
down vote
accepted
I had a look through the pg_* tables, and I couldn't find any creation times in there. It's possible to locate the table files, but then on Linux you can't get file creation time. So I think the answer is that you can only find this information on Windows, using the following steps:
- get the database id with
select datname, datdba from pg_database;
- get the table filenode id with
select relname, relfilenode from pg_class;
- find the table file and look up its creation time; I think the location should be something like
<PostgreSQL folder>/main/base/<database id>/<table filenode id>
(not sure what it is on Windows).
I had a look through the pg_* tables, and I couldn't find any creation times in there. It's possible to locate the table files, but then on Linux you can't get file creation time. So I think the answer is that you can only find this information on Windows, using the following steps:
- get the database id with
select datname, datdba from pg_database;
- get the table filenode id with
select relname, relfilenode from pg_class;
- find the table file and look up its creation time; I think the location should be something like
<PostgreSQL folder>/main/base/<database id>/<table filenode id>
(not sure what it is on Windows).
answered Apr 5 '10 at 7:42
Alex Korban
12.1k53853
12.1k53853
4
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
|
show 1 more comment
4
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
4
4
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
There are some operations on a table, such as CLUSTER, that will generate a new file and not re-use the old one. So this is not a reliable method.
– Magnus Hagander
Apr 5 '10 at 9:15
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Alex Korban: Fully automatized this here: stackoverflow.com/questions/18849756/…
– Stefan Steiger
Sep 17 '13 at 15:09
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
@Quandary: Interesting, thanks. Looks like there's still no bulletproof method to do it, other than storing creation times yourself.
– Alex Korban
Sep 19 '13 at 4:42
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
I need to be a master user? Can you express a are a query (that works), like the @Manoj's?
– Peter Krauss
Jan 13 '14 at 0:01
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
Have a look at @Quandary's link: stackoverflow.com/questions/18849756/…
– Alex Korban
Jan 13 '14 at 4:07
|
show 1 more comment
up vote
17
down vote
You can't - the information isn't recorded anywhere. Looking at the table files won't necessarily give you the right information - there are table operations that will create a new file for you, in which case the date would reset.
add a comment |
up vote
17
down vote
You can't - the information isn't recorded anywhere. Looking at the table files won't necessarily give you the right information - there are table operations that will create a new file for you, in which case the date would reset.
add a comment |
up vote
17
down vote
up vote
17
down vote
You can't - the information isn't recorded anywhere. Looking at the table files won't necessarily give you the right information - there are table operations that will create a new file for you, in which case the date would reset.
You can't - the information isn't recorded anywhere. Looking at the table files won't necessarily give you the right information - there are table operations that will create a new file for you, in which case the date would reset.
answered Apr 5 '10 at 9:15
Magnus Hagander
16.2k34336
16.2k34336
add a comment |
add a comment |
up vote
2
down vote
I don't think it's possible from within PostgreSQL, but you'll probably find it in the underlying table file's creation time.
add a comment |
up vote
2
down vote
I don't think it's possible from within PostgreSQL, but you'll probably find it in the underlying table file's creation time.
add a comment |
up vote
2
down vote
up vote
2
down vote
I don't think it's possible from within PostgreSQL, but you'll probably find it in the underlying table file's creation time.
I don't think it's possible from within PostgreSQL, but you'll probably find it in the underlying table file's creation time.
answered Apr 5 '10 at 6:48
Marcelo Cantos
142k31282328
142k31282328
add a comment |
add a comment |
up vote
0
down vote
Suggested here :
SELECT oid FROM pg_database WHERE datname = 'mydb';
Then (assuming the oid
is 12345) :
ls -l $PGDATA/base/12345/PG_VERSION
This workaround assumes that PG_VERSION
is the least likely to be modified after the creation.
NB : If PGDATA
is not defined, check Where does PostgreSQL store the database?
add a comment |
up vote
0
down vote
Suggested here :
SELECT oid FROM pg_database WHERE datname = 'mydb';
Then (assuming the oid
is 12345) :
ls -l $PGDATA/base/12345/PG_VERSION
This workaround assumes that PG_VERSION
is the least likely to be modified after the creation.
NB : If PGDATA
is not defined, check Where does PostgreSQL store the database?
add a comment |
up vote
0
down vote
up vote
0
down vote
Suggested here :
SELECT oid FROM pg_database WHERE datname = 'mydb';
Then (assuming the oid
is 12345) :
ls -l $PGDATA/base/12345/PG_VERSION
This workaround assumes that PG_VERSION
is the least likely to be modified after the creation.
NB : If PGDATA
is not defined, check Where does PostgreSQL store the database?
Suggested here :
SELECT oid FROM pg_database WHERE datname = 'mydb';
Then (assuming the oid
is 12345) :
ls -l $PGDATA/base/12345/PG_VERSION
This workaround assumes that PG_VERSION
is the least likely to be modified after the creation.
NB : If PGDATA
is not defined, check Where does PostgreSQL store the database?
edited May 23 '17 at 11:54
community wiki
2 revs
Skippy le Grand Gourou
add a comment |
add a comment |
up vote
0
down vote
I'm trying to follow a different way for obtain this.
Starting from this discussion my solution was:
DROP TABLE IF EXISTS t_create_history CASCADE;
CREATE TABLE t_create_history (
gid serial primary key,
object_type varchar(20),
schema_name varchar(50),
object_identity varchar(200),
creation_date timestamp without time zone
);
--delete event trigger before dropping function
DROP EVENT TRIGGER IF EXISTS t_create_history_trigger;
--create history function
DROP FUNCTION IF EXISTS public.t_create_history_func();
CREATE OR REPLACE FUNCTION t_create_history_func()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands () WHERE command_tag in ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
LOOP
INSERT INTO public.t_create_history (object_type, schema_name, object_identity, creation_date) SELECT obj.object_type, obj.schema_name, obj.object_identity, now();
END LOOP;
END;
$$;
--ALTER EVENT TRIGGER t_create_history_trigger DISABLE;
--DROP EVENT TRIGGER t_create_history_trigger;
CREATE EVENT TRIGGER t_create_history_trigger ON ddl_command_end
WHEN TAG IN ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
EXECUTE PROCEDURE t_create_history_func();
In this way you obtain a table that records all the creation tables.
add a comment |
up vote
0
down vote
I'm trying to follow a different way for obtain this.
Starting from this discussion my solution was:
DROP TABLE IF EXISTS t_create_history CASCADE;
CREATE TABLE t_create_history (
gid serial primary key,
object_type varchar(20),
schema_name varchar(50),
object_identity varchar(200),
creation_date timestamp without time zone
);
--delete event trigger before dropping function
DROP EVENT TRIGGER IF EXISTS t_create_history_trigger;
--create history function
DROP FUNCTION IF EXISTS public.t_create_history_func();
CREATE OR REPLACE FUNCTION t_create_history_func()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands () WHERE command_tag in ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
LOOP
INSERT INTO public.t_create_history (object_type, schema_name, object_identity, creation_date) SELECT obj.object_type, obj.schema_name, obj.object_identity, now();
END LOOP;
END;
$$;
--ALTER EVENT TRIGGER t_create_history_trigger DISABLE;
--DROP EVENT TRIGGER t_create_history_trigger;
CREATE EVENT TRIGGER t_create_history_trigger ON ddl_command_end
WHEN TAG IN ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
EXECUTE PROCEDURE t_create_history_func();
In this way you obtain a table that records all the creation tables.
add a comment |
up vote
0
down vote
up vote
0
down vote
I'm trying to follow a different way for obtain this.
Starting from this discussion my solution was:
DROP TABLE IF EXISTS t_create_history CASCADE;
CREATE TABLE t_create_history (
gid serial primary key,
object_type varchar(20),
schema_name varchar(50),
object_identity varchar(200),
creation_date timestamp without time zone
);
--delete event trigger before dropping function
DROP EVENT TRIGGER IF EXISTS t_create_history_trigger;
--create history function
DROP FUNCTION IF EXISTS public.t_create_history_func();
CREATE OR REPLACE FUNCTION t_create_history_func()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands () WHERE command_tag in ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
LOOP
INSERT INTO public.t_create_history (object_type, schema_name, object_identity, creation_date) SELECT obj.object_type, obj.schema_name, obj.object_identity, now();
END LOOP;
END;
$$;
--ALTER EVENT TRIGGER t_create_history_trigger DISABLE;
--DROP EVENT TRIGGER t_create_history_trigger;
CREATE EVENT TRIGGER t_create_history_trigger ON ddl_command_end
WHEN TAG IN ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
EXECUTE PROCEDURE t_create_history_func();
In this way you obtain a table that records all the creation tables.
I'm trying to follow a different way for obtain this.
Starting from this discussion my solution was:
DROP TABLE IF EXISTS t_create_history CASCADE;
CREATE TABLE t_create_history (
gid serial primary key,
object_type varchar(20),
schema_name varchar(50),
object_identity varchar(200),
creation_date timestamp without time zone
);
--delete event trigger before dropping function
DROP EVENT TRIGGER IF EXISTS t_create_history_trigger;
--create history function
DROP FUNCTION IF EXISTS public.t_create_history_func();
CREATE OR REPLACE FUNCTION t_create_history_func()
RETURNS event_trigger
LANGUAGE plpgsql
AS $$
DECLARE
obj record;
BEGIN
FOR obj IN SELECT * FROM pg_event_trigger_ddl_commands () WHERE command_tag in ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
LOOP
INSERT INTO public.t_create_history (object_type, schema_name, object_identity, creation_date) SELECT obj.object_type, obj.schema_name, obj.object_identity, now();
END LOOP;
END;
$$;
--ALTER EVENT TRIGGER t_create_history_trigger DISABLE;
--DROP EVENT TRIGGER t_create_history_trigger;
CREATE EVENT TRIGGER t_create_history_trigger ON ddl_command_end
WHEN TAG IN ('SELECT INTO','CREATE TABLE','CREATE TABLE AS')
EXECUTE PROCEDURE t_create_history_func();
In this way you obtain a table that records all the creation tables.
answered Sep 17 at 12:52
Fatal
1012
1012
add a comment |
add a comment |
up vote
-3
down vote
You can get this from pg_stat_last_operation. Here is how to do it:
select * from pg_stat_last_operation where objid = 'table_name'::regclass order by statime;
This table stores following operations:
select distinct staactionname from pg_stat_last_operation;
staactionname
---------------
ALTER
ANALYZE
CREATE
PARTITION
PRIVILEGE
VACUUM
(6 rows)
5
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
3
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
Tablepg_stat_all_tables
could also help.
– Hans Ginzel
Jun 15 '15 at 8:12
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
up vote
-3
down vote
You can get this from pg_stat_last_operation. Here is how to do it:
select * from pg_stat_last_operation where objid = 'table_name'::regclass order by statime;
This table stores following operations:
select distinct staactionname from pg_stat_last_operation;
staactionname
---------------
ALTER
ANALYZE
CREATE
PARTITION
PRIVILEGE
VACUUM
(6 rows)
5
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
3
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
Tablepg_stat_all_tables
could also help.
– Hans Ginzel
Jun 15 '15 at 8:12
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
up vote
-3
down vote
up vote
-3
down vote
You can get this from pg_stat_last_operation. Here is how to do it:
select * from pg_stat_last_operation where objid = 'table_name'::regclass order by statime;
This table stores following operations:
select distinct staactionname from pg_stat_last_operation;
staactionname
---------------
ALTER
ANALYZE
CREATE
PARTITION
PRIVILEGE
VACUUM
(6 rows)
You can get this from pg_stat_last_operation. Here is how to do it:
select * from pg_stat_last_operation where objid = 'table_name'::regclass order by statime;
This table stores following operations:
select distinct staactionname from pg_stat_last_operation;
staactionname
---------------
ALTER
ANALYZE
CREATE
PARTITION
PRIVILEGE
VACUUM
(6 rows)
edited May 1 '13 at 22:01
tessi
11.2k32844
11.2k32844
answered May 1 '13 at 21:36
Manoj
191
191
5
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
3
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
Tablepg_stat_all_tables
could also help.
– Hans Ginzel
Jun 15 '15 at 8:12
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
5
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
3
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
Tablepg_stat_all_tables
could also help.
– Hans Ginzel
Jun 15 '15 at 8:12
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
5
5
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
ERROR: "pg_stat_last_operation not exist", I am using pg9.2.4.
– Peter Krauss
Jan 12 '14 at 23:58
3
3
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
pg_stat_last_operation is Greenplum.
– Peter Eisentraut
Apr 15 '14 at 4:38
Table
pg_stat_all_tables
could also help.– Hans Ginzel
Jun 15 '15 at 8:12
Table
pg_stat_all_tables
could also help.– Hans Ginzel
Jun 15 '15 at 8:12
1
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
up vote
-3
down vote
--query
select pslo.stasubtype, pc.relname, pslo.statime
from pg_stat_last_operation pslo
join pg_class pc on(pc.relfilenode = pslo.objid)
and pslo.staactionname = 'CREATE'
Order By pslo.statime desc
will help to accomplish desired results
(tried it on greenplum)
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
up vote
-3
down vote
--query
select pslo.stasubtype, pc.relname, pslo.statime
from pg_stat_last_operation pslo
join pg_class pc on(pc.relfilenode = pslo.objid)
and pslo.staactionname = 'CREATE'
Order By pslo.statime desc
will help to accomplish desired results
(tried it on greenplum)
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
up vote
-3
down vote
up vote
-3
down vote
--query
select pslo.stasubtype, pc.relname, pslo.statime
from pg_stat_last_operation pslo
join pg_class pc on(pc.relfilenode = pslo.objid)
and pslo.staactionname = 'CREATE'
Order By pslo.statime desc
will help to accomplish desired results
(tried it on greenplum)
--query
select pslo.stasubtype, pc.relname, pslo.statime
from pg_stat_last_operation pslo
join pg_class pc on(pc.relfilenode = pslo.objid)
and pslo.staactionname = 'CREATE'
Order By pslo.statime desc
will help to accomplish desired results
(tried it on greenplum)
answered Nov 7 '14 at 13:51
Gurupreet Singh Bhatia
447510
447510
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
This is the same answer as Manoj's and greenplum specific.
– dezso
Nov 7 '14 at 14:12
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
I am using two tables
– Gurupreet Singh Bhatia
Dec 8 '14 at 10:59
1
1
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
this does not work in PostgreSQL
– a1an
Jun 19 '15 at 14:34
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f2577168%2fpostgresql-table-creation-time%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown