• Latest
Query Substitution – DZone Database

Query Substitution – DZone Database

January 20, 2022
Mediatek Dimensity 1050 brings mmWave support, Dimensity 930 and Helio G99 tag along

Mediatek Dimensity 1050 brings mmWave support, Dimensity 930 and Helio G99 tag along

May 23, 2022
S.T.A.L.K.E.R. 2 Development Has Reportedly Resumed Following Its Pause Due to Ukraine Invasion

S.T.A.L.K.E.R. 2 Development Has Reportedly Resumed Following Its Pause Due to Ukraine Invasion

May 23, 2022
Soulvars Fatal Error, Bokura, and the 13th Month Announced for Mobile – TouchArcade

Soulvars Fatal Error, Bokura, and the 13th Month Announced for Mobile – TouchArcade

May 23, 2022
Prehistoric Planet: How to watch the new dinosaur docuseries

Prehistoric Planet: How to watch the new dinosaur docuseries

May 23, 2022
Harry Potter: Magic Awakened and Everything Else Featured at NetEase Connect 2022

Harry Potter: Magic Awakened and Everything Else Featured at NetEase Connect 2022

May 23, 2022
Magic: The Gathering Returns to Dungeons & Dragons – See a New Card!

Magic: The Gathering Returns to Dungeons & Dragons – See a New Card!

May 23, 2022
Comparing Distributed Databases – DZone Database

Comparing Distributed Databases – DZone Database

May 23, 2022
Data Security Considerations in CDWs

Data Security Considerations in CDWs

May 23, 2022
Xiaomi officially announces partnership with Leica, first jointly developed phone arrives in July

Xiaomi officially announces partnership with Leica, first jointly developed phone arrives in July

May 23, 2022
Basic Convolutional Neural Network Architectures

Basic Convolutional Neural Network Architectures

May 23, 2022
Configuring a Shopify MuleSoft Connector

Configuring a Shopify MuleSoft Connector

May 23, 2022
Stunning aerial shots of the Dolomites in a post-sunset glow

Stunning aerial shots of the Dolomites in a post-sunset glow

May 23, 2022
Advertise with us
Monday, May 23, 2022
Bookmarks
  • Login
  • Register
GetUpdated
  • Home
  • Game Updates
    • Mobile Gaming
    • Playstation News
    • Xbox News
    • Switch News
    • MMORPG
    • Game News
    • IGN
    • Retro Gaming
  • Tech News
    • Apple Updates
    • Jailbreak News
    • Mobile News
  • Software Development
  • Photography
  • Contact
    • Advertise With Us
    • About
No Result
View All Result
GetUpdated
No Result
View All Result
GetUpdated
No Result
View All Result
ADVERTISEMENT

Query Substitution – DZone Database

January 20, 2022
in Software Development
Reading Time:2 mins read
0 0
0
Share on FacebookShare on WhatsAppShare on Twitter


Zooming In

Let’s assume, as a slightly contrived example, that our application is suddenly having performance problems when it executes the query:

select * from demo.customers where balance > ?

This is not a very good query, but we’re stuck with it.

It turns out that someone has changed the customers table and added a new, very large column named photos, of type blob. That’s another questionable decision, but it’s out of our control.

Our application has no interest in these photos, but it did not specify which columns to retrieve, so now our query returns these photos, needlessly consuming bandwidth and memory.

We’ve already determined that updating the application is not an option, and neither is changing the database. So our only viable option is to have a proxy that will substitute our improved query for the old one. 

Let’s see how this works with Gallium Data, a free database proxy:

Step 1: Install the Database Proxy

Installation is trivial — it’s a simple Docker image, so you can start it up in a minute.

Step 2: Configure the Proxy

Next, we need to set up the proxy so that it connects to the database server. All we need is the host name and port number of the database server. Database credentials are not required because authentication is pass-through. If we need to support encryption, we can either use a new certificate, or the same certificate as the database server (if available).

Step 3: Set up the Query Substitution

Next, we need to tell the proxy which query to catch, and what to substitute it with. That’s done with a request filter, which will look at all the queries coming in over the wire:

Replace:
select * from demo.customers where balance > ?

with:
select name, balance, address from demo.customers where balance > ?

Step 4: Redirect the Application

Finally, we need to tell the application to talk to the proxy, rather than directly to the database. This is usually done by changing a configuration file, an ODBC/JDBC data source, or a command-line parameter.

That’s it — the whole thing can usually be done in a few minutes. Neither the application nor the database server will notice any difference. From now on, the “bad” query will be replaced with the “good” query every time the application issues it.

Once this is in place, doing the same thing for other queries is of course trivial — more request filters can be created and deployed in moments.



Source link

ShareSendTweet
Previous Post

The iPhone SE+ 5G will become available in late April or early May, claims analyst

Next Post

Call of Duty: Warzone Pacific Season 2 Delayed

Related Posts

Comparing Distributed Databases – DZone Database

May 23, 2022
0
0
Comparing Distributed Databases – DZone Database
Software Development

The past decade saw the rise of fully distributed databases. Not just local clustering to enable basic load balancing and...

Read more

Data Security Considerations in CDWs

May 23, 2022
0
0
Data Security Considerations in CDWs
Software Development

This is an article from DZone's 2022 Data Pipelines Trend Report.For more: Read the Report Cloud data warehouses (CDWs) are...

Read more
Next Post
Call of Duty: Warzone Pacific Season 2 Delayed

Call of Duty: Warzone Pacific Season 2 Delayed

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2021 GetUpdated – MW.

  • About
  • Advertise
  • Privacy & Policy
  • Terms & Conditions
  • Contact

No Result
View All Result
  • Home
  • Game Updates
    • Mobile Gaming
    • Playstation News
    • Xbox News
    • Switch News
    • MMORPG
    • Game News
    • IGN
    • Retro Gaming
  • Tech News
    • Apple Updates
    • Jailbreak News
    • Mobile News
  • Software Development
  • Photography
  • Contact
    • Advertise With Us
    • About

Welcome Back!

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?