我使用以下命令导入了我的表:
sudo -u postgres psql enwiki -c "COPY public.categorylinks FROM '`pwd`/enwiki-latest-categorylinks.txt' WITH DELIMITER E'\t' CSV QUOTE '''' ESCAPE '\\' encoding 'latin1';"
然后我运行一个查询来检索表统计信息:
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size" FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') ORDER BY pg_relation_size(C.oid) DESC LIMIT 20;
它给了我以下输出:
public.categorylinks | 8864 MB
public.cl_sortkey | 8312 MB
public.cl_from | 3963 MB
public.category_title | 142 MB
public.category | 137 MB
但是,如果我尝试从 categorylinks 表中进行选择,我不会收到任何结果。这是我的输出:
enwiki=# select count(*) from categorylinks;
count
-----
0
select * from categorylinks limit 1;
cl_from | cl_to | cl_sortkey | cl_timestamp | cl_sortkey_prefix | cl_collation | cl_type
---------+-------+------------+--------------+-------------------+--------------+---------
(0 rows)
有任何想法吗?