Advertisement
Guest User

Untitled

a guest
Apr 5th, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. CREATE TABLE test_table (
  2. ogc_fid integer primary key,
  3. mapid character(8),
  4. kind character(4),
  5. name character(100),
  6. pinyin character(250),
  7. exonym character(250),
  8. adminname character(50),
  9. zipcode character(6),
  10. address character(100),
  11. telephone character(15),
  12. admincode character(6),
  13. isindex character(1),
  14. isother character(1),
  15. keyword character(250),
  16. display_x character(12),
  17. display_y character(12),
  18. poiid character(15),
  19. flname character varying(50)
  20. );
  21.  
  22.  
  23. INSERT INTO test_table
  24. SELECT i, /* ogc_fid */
  25. substr(md5(i::text), 0, 8), /* mapid */
  26. substr(md5((i+1)::text), 0, 4), /* kind */
  27. repeat(substr(md5((i+2)::text), 0, 4),25), /* name */
  28. repeat(substr(md5((i+3)::text), 0, 10),25), /* pinyin */
  29. repeat(substr(md5((i+4)::text), 0, 10),25), /* exonym */
  30. repeat(substr(md5((i+5)::text), 0, 10),5), /* adminname */
  31. substr(md5((i+6)::text), 0, 6), /* zipcode */
  32. repeat(substr(md5((i+7)::text), 0, 10),10), /* address */
  33. substr(md5((i+8)::text), 0, 15), /* telephone */
  34. substr(md5((i+9)::text), 0, 6), /* admincode */
  35. substr(md5((i+10)::text), 0, 1), /* isindex */
  36. substr(md5((i+11)::text), 0, 1), /* isother */
  37. repeat(substr(md5((i+12)::text), 0, 10),25), /* keyword */
  38. substr(md5((i+13)::text), 0, 12), /* display_x */
  39. substr(md5((i+14)::text), 0, 12), /* display_y */
  40. substr(md5((i+15)::text), 0, 15), /* poiid */
  41. repeat(substr(md5((i+16)::text), 0, 10),5) /* display_x */
  42. FROM generate_series(1,1000000) s(i);
  43.  
  44.  
  45. ANALYZE test_table;
  46.  
  47. SELECT pg_size_pretty(pg_relation_size('test_table'));
  48.  
  49. \timing on
  50.  
  51. SELECT count(*) from test_table;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement