pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Adding memory query cache to ODBC driver
9+ messages / 4 participants
[nested] [flat]

* Adding memory query cache to ODBC driver
@ 2013-12-08 08:51 Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Pliszka, Jacek @ 2013-12-08 08:51 UTC (permalink / raw)
  To: pgsql-odbc

Hi!

I wonder if it would be possible to add some kind of caching to  the driver.

Something like memory cache in pgpool:

https://lists.postgresql.org/mj/mj_confirm/domain=postgresql.org?t=06E9-8DF3-1B50

In minimal it would one more input field in driver configuration with number.

If number is 0 – driver behaves as now.

If number is  e.g. 60 – then the select queries sent in the last 60s together with their results are kept in memory
And if within these 60s they are sent from the client again – the answer is return from the memory.

The rationale for this change is certain class of client applications that have some kind of ORM and issue very many
Identical queries in short time. If such are run on WAN/VPN  with many network hops.
I have run some tests and currently PGSQL ODBC issues 2x more queries than MS SQL or MySQL and seems 2x slower
Because of that so these dbs are chose over PGSQL.

With such option the PGSQL should be 3-4x faster than MS SQL/MySQL.

I am aware we are losing a bit of consistency here but pgpool does the same.

Best Regards,

Jacek



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
@ 2013-12-08 19:53 ` Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Heikki Linnakangas @ 2013-12-08 19:53 UTC (permalink / raw)
  To: Pliszka, Jacek <jacek.pliszka@hp.com>; +Cc: pgsql-odbc

On 12/08/2013 10:51 AM, Pliszka, Jacek wrote:
> Hi!
>
> I wonder if it would be possible to add some kind of caching to  the driver.
>
> Something like memory cache in pgpool:

I'm sure that would be useful for many applications, but I don't think 
that belongs in the driver. A standalone generic query cache, which 
would act as a wrapper around any ODBC connection, would be nice.

- Heikki


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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-12-08 20:22   ` Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 16:02     ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Pliszka, Jacek @ 2013-12-08 20:22 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: pgsql-odbc

OK, but as for the last 21 years I've developed for Linux 99% of the standalone ODBC cache is way beyond me.  :)
Doing the cache on the PostgreSQL protocol level looks easier for me.

And this was an idea to give an option to make PostgreSQL ODBC driver look better than  MS/My SQL. :)

BR,

Jacek

-----Original Message-----
From: Heikki Linnakangas [mailto:hlinnakangas@vmware.com] 
Sent: 8 grudnia 2013 20:54
To: Pliszka, Jacek
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

On 12/08/2013 10:51 AM, Pliszka, Jacek wrote:
> Hi!
>
> I wonder if it would be possible to add some kind of caching to  the driver.
>
> Something like memory cache in pgpool:

I'm sure that would be useful for many applications, but I don't think that belongs in the driver. A standalone generic query cache, which would act as a wrapper around any ODBC connection, would be nice.

- Heikki

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


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
@ 2013-12-09 16:02     ` Mike Landl <mlandl@4glsol.com>
  2013-12-09 17:42       ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Mike Landl @ 2013-12-09 16:02 UTC (permalink / raw)
  To: 'Pliszka, Jacek' <jacek.pliszka@hp.com>; +Cc: pgsql-odbc

Is this (https://code.google.com/p/pqc/) what you were looking for?
It looks like the project has become stagnant but maybe somebody can resurrect it. 

Mike Landl

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Pliszka, Jacek
Sent: Sunday, December 08, 2013 3:22 PM
To: Heikki Linnakangas
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

OK, but as for the last 21 years I've developed for Linux 99% of the standalone ODBC cache is way beyond me.  :) Doing the cache on the PostgreSQL protocol level looks easier for me.

And this was an idea to give an option to make PostgreSQL ODBC driver look better than  MS/My SQL. :)

BR,

Jacek

-----Original Message-----
From: Heikki Linnakangas [mailto:hlinnakangas@vmware.com]
Sent: 8 grudnia 2013 20:54
To: Pliszka, Jacek
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

On 12/08/2013 10:51 AM, Pliszka, Jacek wrote:
> Hi!
>
> I wonder if it would be possible to add some kind of caching to  the driver.
>
> Something like memory cache in pgpool:

I'm sure that would be useful for many applications, but I don't think that belongs in the driver. A standalone generic query cache, which would act as a wrapper around any ODBC connection, would be nice.

- Heikki

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



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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 16:02     ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
@ 2013-12-09 17:42       ` Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 18:14         ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
  2013-12-09 18:18         ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 2 replies; 9+ messages in thread

From: Pliszka, Jacek @ 2013-12-09 17:42 UTC (permalink / raw)
  To: Mike Landl <mlandl@4glsol.com>; +Cc: pgsql-odbc

Something like this but not quite:

1. pqc is Linux C - I could use myself but majority of users are Windows ODBC clients.

2. pqc looks like based on  pgpool - I would rather use pgpool - but this on the server and my problem
Is not load of the db - it is the Very Wide Area Network - for this I need the cache as close to client as possible
- closest thing is ODBC.

Last but not least... I hacked a small crude SQL cache in Python and :

Oracle   : 90s
PostgreSQL  : 85s
MS SQL: 45s
MySQL: 33s
PostgreSQL with my crude cache: 22s

BR,

Jacek

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mike Landl
Sent: 9 grudnia 2013 17:03
To: Pliszka, Jacek
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

Is this (https://code.google.com/p/pqc/) what you were looking for?
It looks like the project has become stagnant but maybe somebody can resurrect it. 

Mike Landl

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Pliszka, Jacek
Sent: Sunday, December 08, 2013 3:22 PM
To: Heikki Linnakangas
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

OK, but as for the last 21 years I've developed for Linux 99% of the standalone ODBC cache is way beyond me.  :) Doing the cache on the PostgreSQL protocol level looks easier for me.

And this was an idea to give an option to make PostgreSQL ODBC driver look better than  MS/My SQL. :)

BR,

Jacek

-----Original Message-----
From: Heikki Linnakangas [mailto:hlinnakangas@vmware.com]
Sent: 8 grudnia 2013 20:54
To: Pliszka, Jacek
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

On 12/08/2013 10:51 AM, Pliszka, Jacek wrote:
> Hi!
>
> I wonder if it would be possible to add some kind of caching to  the driver.
>
> Something like memory cache in pgpool:

I'm sure that would be useful for many applications, but I don't think that belongs in the driver. A standalone generic query cache, which would act as a wrapper around any ODBC connection, would be nice.

- Heikki

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



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

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


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 16:02     ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
  2013-12-09 17:42       ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
@ 2013-12-09 18:14         ` Mike Landl <mlandl@4glsol.com>
  1 sibling, 0 replies; 9+ messages in thread

From: Mike Landl @ 2013-12-09 18:14 UTC (permalink / raw)
  To: 'Pliszka, Jacek' <jacek.pliszka@hp.com>; +Cc: pgsql-odbc

Okay, I see what you mean now. 
I wish I could help you out but I fear my limited knowledge won't be of much use here.


-----Original Message-----
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Pliszka, Jacek
Sent: Monday, December 09, 2013 12:42 PM
To: Mike Landl
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

Something like this but not quite:

1. pqc is Linux C - I could use myself but majority of users are Windows ODBC clients.

2. pqc looks like based on  pgpool - I would rather use pgpool - but this on the server and my problem Is not load of the db - it is the Very Wide Area Network - for this I need the cache as close to client as possible
- closest thing is ODBC.

Last but not least... I hacked a small crude SQL cache in Python and :

Oracle   : 90s
PostgreSQL  : 85s
MS SQL: 45s
MySQL: 33s
PostgreSQL with my crude cache: 22s

BR,

Jacek

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mike Landl
Sent: 9 grudnia 2013 17:03
To: Pliszka, Jacek
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

Is this (https://code.google.com/p/pqc/) what you were looking for?
It looks like the project has become stagnant but maybe somebody can resurrect it. 

Mike Landl

-----Original Message-----
From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Pliszka, Jacek
Sent: Sunday, December 08, 2013 3:22 PM
To: Heikki Linnakangas
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

OK, but as for the last 21 years I've developed for Linux 99% of the standalone ODBC cache is way beyond me.  :) Doing the cache on the PostgreSQL protocol level looks easier for me.

And this was an idea to give an option to make PostgreSQL ODBC driver look better than  MS/My SQL. :)

BR,

Jacek

-----Original Message-----
From: Heikki Linnakangas [mailto:hlinnakangas@vmware.com]
Sent: 8 grudnia 2013 20:54
To: Pliszka, Jacek
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Adding memory query cache to ODBC driver

On 12/08/2013 10:51 AM, Pliszka, Jacek wrote:
> Hi!
>
> I wonder if it would be possible to add some kind of caching to  the driver.
>
> Something like memory cache in pgpool:

I'm sure that would be useful for many applications, but I don't think that belongs in the driver. A standalone generic query cache, which would act as a wrapper around any ODBC connection, would be nice.

- Heikki

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



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

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



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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 16:02     ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
  2013-12-09 17:42       ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
@ 2013-12-09 18:18         ` Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-09 20:52           ` Re: Adding memory query cache to ODBC driver Jonah H. Harris <jonah.harris@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Heikki Linnakangas @ 2013-12-09 18:18 UTC (permalink / raw)
  To: Pliszka, Jacek <jacek.pliszka@hp.com>; +Cc: Mike Landl <mlandl@4glsol.com>; pgsql-odbc

On 12/09/2013 07:42 PM, Pliszka, Jacek wrote:
> 2. pqc looks like based on  pgpool - I would rather use pgpool - but this on the server and my problem
> Is not load of the db - it is the Very Wide Area Network - for this I need the cache as close to client as possible
> - closest thing is ODBC.

You could run pgpool in the client.

- Heikki


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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 16:02     ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
  2013-12-09 17:42       ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 18:18         ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-12-09 20:52           ` Jonah H. Harris <jonah.harris@gmail.com>
  2013-12-09 22:11             ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Jonah H. Harris @ 2013-12-09 20:52 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Pliszka, Jacek <jacek.pliszka@hp.com>; Mike Landl <mlandl@4glsol.com>; pgsql-odbc

On Mon, Dec 9, 2013 at 1:18 PM, Heikki Linnakangas
<hlinnakangas@vmware.com>wrote:

> On 12/09/2013 07:42 PM, Pliszka, Jacek wrote:
>
>> 2. pqc looks like based on  pgpool - I would rather use pgpool - but this
>> on the server and my problem
>> Is not load of the db - it is the Very Wide Area Network - for this I
>> need the cache as close to client as possible
>> - closest thing is ODBC.
>>
>
> You could run pgpool in the client.


That was my thinking as well.

Embedding this functionality directly into the driver seems like a lot of
work for very little gain. That is, what is the probability of each client
performing the exact same query? And, as I assume there are multiple
clients connecting to the database, why wouldn't it be more advantageous
for multiple clients to share the same cache (e.g. pgpool being used as it
is designed, to proxy and, as already implemented, cache the data?)

-- 
Jonah H. Harris
Blog: http://www.oracle-internals.com/

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: Adding memory query cache to ODBC driver
  2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-08 19:53 ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-08 20:22   ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 16:02     ` Re: Adding memory query cache to ODBC driver Mike Landl <mlandl@4glsol.com>
  2013-12-09 17:42       ` Re: Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
  2013-12-09 18:18         ` Re: Adding memory query cache to ODBC driver Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-09 20:52           ` Re: Adding memory query cache to ODBC driver Jonah H. Harris <jonah.harris@gmail.com>
@ 2013-12-09 22:11             ` Pliszka, Jacek <jacek.pliszka@hp.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Pliszka, Jacek @ 2013-12-09 22:11 UTC (permalink / raw)
  To: Jonah H. Harris <jonah.harris@gmail.com>; Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Mike Landl <mlandl@4glsol.com>; pgsql-odbc



Ø  You could run pgpool in the client.

Unfortunately  I cannot, firstly – as I wrote – clients are mostly Windows (no pgpool on Windows),
Secondly this customer, suppliers, third parties – I have nothing to say about their systems.


Ø  Embedding this functionality directly into the driver seems like a lot of work for very little gain.

The functionality is in the pgpool/pqc – there is definitely work too factor it out into a library.


Ø  That is, what is the probability of each client performing the exact same query?

For the test I did today (Enterprise Architect software) – over 95%. Out of around 3900 queries only 251 were unique.
Never underestimate innovative ways to write and integrate software. ☺


Ø   And, as I assume there are multiple clients connecting to the database, why wouldn't it be more advantageous for multiple clients to share the same cache (e.g. pgpool being used as it is designed, to proxy and, as already implemented, cache the data?)

Because this is not the problem with the central DB – it  is the problem with very complicated network configuration with dozens of
Firewalls, gateways etc. etc.

The cost is not in the db backend performance – cost is in the number of packets sent over the network.

Anyway it looks like consensus is that is not the best idea.

I’ll probably spend couple more hours on the crude Python cache I used for tests – make .exe out of it
And give it to the most problematic clients.

BR,

Jacek




^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2013-12-09 22:11 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-12-08 08:51 Adding memory query cache to ODBC driver Pliszka, Jacek <jacek.pliszka@hp.com>
2013-12-08 19:53 ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-12-08 20:22   ` Pliszka, Jacek <jacek.pliszka@hp.com>
2013-12-09 16:02     ` Mike Landl <mlandl@4glsol.com>
2013-12-09 17:42       ` Pliszka, Jacek <jacek.pliszka@hp.com>
2013-12-09 18:14         ` Mike Landl <mlandl@4glsol.com>
2013-12-09 18:18         ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-12-09 20:52           ` Jonah H. Harris <jonah.harris@gmail.com>
2013-12-09 22:11             ` Pliszka, Jacek <jacek.pliszka@hp.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox