postgresql - postgres cannot select from huge table after imported -
i imported table using following command:
sudo -u postgres psql enwiki -c "copy public.categorylinks '`pwd`/enwiki-latest-categorylinks.txt' delimiter e'\t' csv quote '''' escape '\\' encoding 'latin1';"
i ran query retrieve table statistics:
select nspname || '.' || relname "relation", pg_size_pretty(pg_relation_size(c.oid)) "size" pg_class c left join pg_namespace n on (n.oid = c.relnamespace) nspname not in ('pg_catalog', 'information_schema') order pg_relation_size(c.oid) desc limit 20;
it gave me following output:
public.categorylinks | 8864 mb public.cl_sortkey | 8312 mb public.cl_from | 3963 mb public.category_title | 142 mb public.category | 137 mb
however, if try select categorylinks table, not receive results. here output:
enwiki=# select count(*) categorylinks; count ----- 0 select * categorylinks limit 1; cl_from | cl_to | cl_sortkey | cl_timestamp | cl_sortkey_prefix | cl_collation | cl_type ---------+-------+------------+--------------+-------------------+--------------+--------- (0 rows)
any ideas?
possible causes problems include:
1) having created table in 1 transaction, copied in , then, if neglect commit, try select in session. in fact had happen today :-p
2) copy succeeds, later in transaction fails, causing rows disappear on rollback.
because of way postgresql stores data, these pretty routine cases , explain virtually such row disappearances. both behavior design , resolved making sure transaction inserted rows commits , without other errors.
Comments
Post a Comment