Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3abfc69

Browse files
author
Liudmila Mantrova
committed
DOC: implemented feedback for in-memory
1 parent b45324b commit 3abfc69

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

doc/src/sgml/in-memory.sgml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,22 @@
1616
<para>
1717
Fast random access on the primary key.
1818
This can result in significant performance benefits when
19-
working with data that has to be moved to RAM and requires
20-
a very high read and write access rate,
21-
especially on multi-core systems.
19+
working with data that requires a very high read and write
20+
access rate, especially on multi-core systems.
2221
</para>
2322
</listitem>
2423
<listitem>
2524
<para>
26-
Saving disk space: there is no primary key
27-
duplication as all data is stored directly in the index.
25+
Effective space usage.
26+
There is no primary key duplication as all data
27+
is stored directly in the index.
2828
</para>
2929
</listitem>
3030
</itemizedlist>
3131
</para>
3232

3333
<para>
34-
Just like regular heap-organized tables,
35-
in-memory tables support transactions, including savepoints.
34+
In-memory tables support transactions, including savepoints.
3635
However, the data in such tables is stored only while the server is running.
3736
Once the server is shut down, all in-memory data gets truncated.
3837
When using in-memory tables, you should also take into account the following
@@ -202,20 +201,20 @@ OPTIONS (INDICES '(id, author COLLATE "ru_RU" ASC)');
202201
Fill the <structname>blog_views</structname>
203202
table with initial zero values for initial ten blog posts:
204203
<programlisting>
205-
# INSERT INTO blog_views (SELECT id, 0 FROM generate_series(1, 10) AS id);
204+
postgres=# INSERT INTO blog_views (SELECT id, 0 FROM generate_series(1, 10) AS id);
206205
</programlisting>
207206
</para>
208207

209208
<para>Increment the view count for a couple of posts
210209
and display the result:
211210
<programlisting>
212-
# UPDATE blog_views SET views = views + 1 WHERE id = 1;
211+
postgres=# UPDATE blog_views SET views = views + 1 WHERE id = 1;
213212
UPDATE 1
214-
# UPDATE blog_views SET views = views + 1 WHERE id = 1;
213+
postgres=# UPDATE blog_views SET views = views + 1 WHERE id = 1;
215214
UPDATE 2
216-
# UPDATE blog_views SET views = views + 1 WHERE id = 2;
215+
postgres=# UPDATE blog_views SET views = views + 1 WHERE id = 2;
217216
UPDATE 1
218-
# SELECT * FROM blog_views WHERE id = 1 OR id = 2;
217+
postgres=# SELECT * FROM blog_views WHERE id = 1 OR id = 2;
219218
id | views
220219
----+-------
221220
1 | 2
@@ -227,7 +226,7 @@ UPDATE 1
227226
Check planning and execution costs for a query that
228227
only requires a primary key lookup:
229228
<programlisting>
230-
# EXPLAIN ANALYZE SELECT * FROM blog_views WHERE id = 1;
229+
postgres=# EXPLAIN ANALYZE SELECT * FROM blog_views WHERE id = 1;
231230
QUERY PLAN
232231
-------------------------------------------------------------------
233232
Foreign Scan on blog_views (cost=0.02..0.03 rows=1 width=16)
@@ -242,7 +241,7 @@ Execution time: 0.035 ms
242241
Check the costs of calculating the sum of all views, which requires
243242
a full index scan:
244243
<programlisting>
245-
# EXPLAIN ANALYZE SELECT SUM(views) FROM blog_views;
244+
postgres=# EXPLAIN ANALYZE SELECT SUM(views) FROM blog_views;
246245
QUERY PLAN
247246
--------------------------------------------------------------------
248247
Aggregate (cost=1.62..1.63 rows=1 width=32)
@@ -319,7 +318,7 @@ Execution time: 0.353 ms
319318
as well as the total number of pages allocated for in-memory tables.
320319
For example:
321320
<screen>
322-
# SELECT * FROM in_memory.in_memory_page_stats();
321+
postgres=# SELECT * FROM in_memory.in_memory_page_stats();
323322
used_pages | free_pages | all_pages
324323
------------+------------+-----------
325324
576 | 7616 | 8192

0 commit comments

Comments
 (0)