Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwDTF-0007rb-QH for pgsql-performance@arkaria.postgresql.org; Mon, 08 Jul 2013 15:35:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UwDTF-00072R-7S for pgsql-performance@arkaria.postgresql.org; Mon, 08 Jul 2013 15:35:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwDTE-00072L-5R for pgsql-performance@postgresql.org; Mon, 08 Jul 2013 15:35:20 +0000 Received: from mrelay.celltick.com ([212.150.2.147] helo=Cobra.celltick.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UwDT9-0000vI-F6 for pgsql-performance@postgresql.org; Mon, 08 Jul 2013 15:35:19 +0000 Received: from Cobra.celltick.com ([172.17.252.101]) by Cobra.celltick.com ([172.17.252.101]) with mapi id 14.03.0123.003; Mon, 8 Jul 2013 18:34:49 +0300 From: Yuri Levinsky To: Radu-Stefan Zugravu , Richard Huxton CC: "pgsql-performance@postgresql.org" Subject: Re: How to properly index hstore tags column to faster search for keys Thread-Topic: [PERFORM] How to properly index hstore tags column to faster search for keys Thread-Index: AQHOe68p3JOenIKjAka1/7XXeS1acZlaQUwAgAAGRQCAAAd5gIAAmU6Q Date: Mon, 8 Jul 2013 15:34:49 +0000 Message-ID: References: <51DA6DE9.4030309@archonet.com> <51DA7E08.6090007@archonet.com> In-Reply-To: Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [172.17.252.49] Content-Type: multipart/related; boundary="_004_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_"; type="multipart/alternative" MIME-Version: 1.0 X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --_004_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_ Content-Type: multipart/alternative; boundary="_000_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_" --_000_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear Radu-Stefan, It seems to me that you trying hard to solve a problem by SQL that probably= can't be solved. Take a look please on Apache HBase. You can access HBase = from PostgreSQL as well by utilizing Java or Python for example. Sincerely yours, [Description: Celltick logo_highres] Yuri Levinsky, DBA Celltick Technologies Ltd., 32 Maskit St., Herzliya 46733, Israel Mobile: +972 54 6107703, Office: +972 9 9710239; Fax: +972 9 9710222 From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owne= r@postgresql.org] On Behalf Of Radu-Stefan Zugravu Sent: Monday, July 08, 2013 12:20 PM To: Richard Huxton Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] How to properly index hstore tags column to faster s= earch for keys Any improvement is welcomed. The overall performance of the application is = not very good. It takes about 200 seconds to compute a path for not so far = star and end points. I want to improve this query as much as I can. How exactly should I post the explain without the index? Do I have to drop = all created indexes for the tags column? It takes some time to create them = back. On Mon, Jul 8, 2013 at 11:53 AM, Richard Huxton > wrote: On 08/07/13 09:31, Radu-Stefan Zugravu wrote: Hi, Thank you for your answer. My EXPLAIN ANALYZE output can be found here: http://explain.depesz.com/s/Wbo. Thanks Also, there is a discution on this subject on dba.stackexchange.com : http://dba.stackexchange.com/questions/45820/how-to-properly-index-hstore-t= ags-column-to-faster-search-for-keys Thanks - also useful to know. I can't see anything wrong with your query. Reading it from the bottom upwa= rds: 1. Index used for "historic" search - builds a bitmap of blocks 2. Index used for geometry search - builds a bitmap of blocks 3. See where the bitmaps overlap (BitmapAnd) 4. Grab those disk blocks and find the rows (Bitmap Heap Scan) The whole thing takes under 20ms - what sort of time were you hoping for? The bulk of it (15ms) is taken up locating the "historic" rows. There are 3= 6351 of those, but presumably most of them are far away on the map. Could you post the explain without the index? I'm curious as to how slow it= is just testing the tags after doing the geometry search. -- Richard Huxton Archonet Ltd -- Radu-Stefan Zugravu 0755 950 145 0760 903 464 raduzugravu90@gmail.com radu.zugravu@yahoo.com This mail was received via Mail-SeCure System. --_000_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Dear Radu-Stefan,

It seems to me that you trying h= ard to solve a problem by SQL that probably can't be solved. Take a look pl= ease on Apache HBase. You can access HBase from PostgreSQL as well by utilizing Java or Python for example.     &= nbsp;

 

Sincerely yours,

 

Yuri Levinsky, DBA

Celltick Technologies Ltd., 32= Maskit St., Herzliya 46733, Israel

Mobile: +972 54 6107703, O= ffice: +972 9 9710239; Fax: +972 9 9710222

 

From: pgsql-pe= rformance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.o= rg] On Behalf Of Radu-Stefan Zugravu
Sent: Monday, July 08, 2013 12:20 PM
To: Richard Huxton
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] How to properly index hstore tags column to f= aster search for keys

 

Any improvement is welcomed. The overall performance= of the application is not very good. It takes about 200 seconds to compute= a path for not so far star and end points. I want to improve this query as= much as I can.

How exactly should I post the explain without the in= dex? Do I have to drop all created indexes for the tags column? It takes so= me time to create them back.

 

On Mon, Jul 8, 2013 at 11:53 AM, Richard Huxton <= dev@archonet.com&= gt; wrote:

On 08/07/13 09:31, Radu-Stefan Zugravu wrote:

Hi,
Thank you for your answer.
My EXPLAIN ANALYZE output can be found here:
http://explai= n.depesz.com/s/Wbo.

 

Thanks

Also, there is a discution on this subject on dba.stackexchange.com

<http://dba.stackexchange.com>:
http://d= ba.stackexchange.com/questions/45820/how-to-properly-index-hstore-tags-colu= mn-to-faster-search-for-keys


Thanks - also useful to know.

I can't see anything wrong with your query. Reading it from the bottom upwa= rds:
1. Index used for "historic" search - builds a bitmap of blocks 2. Index used for geometry search - builds a bitmap of blocks
3. See where the bitmaps overlap (BitmapAnd)
4. Grab those disk blocks and find the rows (Bitmap Heap Scan)

The whole thing takes under 20ms - what sort of time were you hoping for?
The bulk of it (15ms) is taken up locating the "historic" rows. T= here are 36351 of those, but presumably most of them are far away on the ma= p.

Could you post the explain without the index? I'm curious as to how slow it= is just testing the tags after doing the geometry search.



--
  Richard Huxton
  Archonet Ltd



 

--

Radu-Stefan Zugravu

0755 950 145
0760 903 464
raduzugravu90@= gmail.com
radu.zugravu@ya= hoo.com


This mail was received via Mail-SeCure System.

--_000_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_-- --_004_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_ Content-Type: image/jpeg; name="image002.jpg" Content-Description: image002.jpg Content-Disposition: inline; filename="image002.jpg"; size=2228; creation-date="Mon, 08 Jul 2013 15:34:49 GMT"; modification-date="Mon, 08 Jul 2013 15:34:49 GMT" Content-ID: Content-Transfer-Encoding: base64 /9j/4AAQSkZJRgABAQEAkACQAAD/2wBDAAoHBwkHBgoJCAkLCwoMDxkQDw4ODx4WFxIZJCAmJSMg IyIoLTkwKCo2KyIjMkQyNjs9QEBAJjBGS0U+Sjk/QD3/2wBDAQsLCw8NDx0QEB09KSMpPT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT3/wAARCAA1AI8DASIA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo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Ehd8v7hk7Yo8X61P/wsPTr3aubFtsadjn1oooAueLr6Tw54rsvElqA01zBteFvukfWr/jTxBLqf gK23QpH/AGkCHwc7PpRRQA3RNIh8Z/D5dL1EkC0H7qZPvDHSua0n4lat4dujojhL2OBtiSynDYzi iigDY+J2pzX8OnRHEaptnOOcn0qv4xu2vdJ0jXIgLfUbcgLNH1IHY0UUAdjpHiW41bwnJezRoJlT Bx396x/B+TryuT94E4oor0cOv9nmeLjf97pno1KKKK85bHtDX+7VZtNtWuvtDRKZMYziiimm1sTK Ke6P/9k= --_004_C9278837BA426D4DBDF8996DB8902326021A28Cobracelltickcom_--