Re: Slow Query - PostgreSQL 9.2 - Mailing list pgsql-general

From Vitaly Burovoy
Subject Re: Slow Query - PostgreSQL 9.2
Date
Msg-id CAKOSWNkX=D=kk9+jb6O=DSjy5ueq8+j8wh35rK4wNpZ4jkUY0w@mail.gmail.com
Whole thread Raw
In response to Re: Slow Query - PostgreSQL 9.2  (Saulo Merlo <smerlo50@outlook.com>)
Responses Re: Slow Query - PostgreSQL 9.2
List pgsql-general
On 1/11/16, Saulo Merlo <smerlo50@outlook.com> wrote:
> Ok, thanks Vitaly.
> I need to create a TEXT or VARCHAR index.
> and another one with timestamptz
> How can I do?Thanks

How to create indexes of different types is written at [1].
But I thing you need something else. You have to create index on the
specified column(s). Type of data will be recognized by a column type.
Your primary goal is to avoid sequence scan of big tables. It is
important to read explain[2] and find _tables_ and _columns_ (or
_expressions_) where they appears in the "seq scan/filter" blocks to
decide whether it worth to create an index or not.
You can create index on expression[3] where column(s) of the table or
constants are involved, but keep in mind it is impossible to create an
index using columns of different tables or using non-constants (e.g.
"now()").

Note that your two last posts doesn't have information what columns you need.

[1] http://www.postgresql.org/docs/9.2/static/indexes-types.html
[2] http://www.postgresql.org/docs/9.2/static/using-explain.html
[3] http://www.postgresql.org/docs/9.2/static/indexes-expressional.html


P.S.: please, delete old (irrelevant) information which is not
necessary for answering.

>
> From: smerlo50@outlook.com
> To: clavadetscher@swisspug.org; vitaly.burovoy@gmail.com
> CC: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Slow Query - PostgreSQL 9.2
> Date: Mon, 11 Jan 2016 21:37:43 +0000
>
> Hey guys..
> How could I create a timestampandtz index?
> CREATE TABLE gorfs.inode_segments
> (
>  <<overquoting>>
> )

--
Best regards,
Vitaly Burovoy


pgsql-general by date:

Previous
From: James Keener
Date:
Subject: Re: WIP: CoC
Next
From: "Joshua D. Drake"
Date:
Subject: Re: WIP: CoC