Search Postgresql Archives

Re: Slow Query - PostgreSQL 9.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/11/16, Saulo Merlo <smerlo50@xxxxxxxxxxx> 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@xxxxxxxxxxx
> To: clavadetscher@xxxxxxxxxxxx; vitaly.burovoy@xxxxxxxxx
> CC: pgsql-general@xxxxxxxxxxxxxx
> Subject: Re:  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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux