Fork me on GitHub

daydayup863

人生就像一杯茶,不会苦一辈子,但总会苦一阵子。

0%

backward index scan

1
2
3
4
5
6
7
8
9
10
mydb=# explain analyze select data_id,create_time from test_table where status=0 and city_id=310188 and type=103  and sub_type=any(array[10306,10304,10305]) order by create_time desc limit 1;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.44..1615.86 rows=1 width=16) (actual time=10945.944..10945.945 rows=1 loops=1)
-> Index Scan Backward using test_table_create_time_idx on test_table (cost=0.44..1936888.15 rows=1199 width=16) (actual time=10945.942..10945.942 rows=1 loops=1)
Filter: ((status = 0) AND (city_id = 310188) AND (type = 103) AND (sub_type = ANY ('{10306,10304,10305}'::integer[])))
Rows Removed by Filter: 9975856
Planning time: 0.573 ms
Execution time: 10945.974 ms
(6 rows)
阅读全文 »

Ubuntu中的许多操作在终端(Terminal)中十分的快捷,记住一些快捷键的操作更得心应手。在Ubuntu中打开终端的快捷键是Ctrl+Alt+T。其他的一些常用的快捷键如下:

阅读全文 »

function 返回多个游标

1
2
3
4
5
6
7
8
9
10
11
12
CREATE OR REPLACE FUNCTION show_cities_multiple() RETURNS SETOF refcursor AS $$
DECLARE
ref1 refcursor; -- Declare cursor variables
ref2 refcursor;
BEGIN
OPEN ref1 FOR SELECT 1; -- Open the first cursor
RETURN NEXT ref1; -- Return the cursor to the caller

OPEN ref2 FOR SELECT 2; -- Open the second cursor
RETURN NEXT ref2; -- Return the cursor to the caller
END;
$$ LANGUAGE plpgsql;
阅读全文 »

将 image 文件从仓库抓取到本地, 默认library组

1
2
3
$ docker image pull library/hello-world
$ docker image pull hello-world

列出本机的所有 image 文件。

1
$ docker image ls

删除 image 文件

1
$ docker rmi [imageName]
阅读全文 »