Parse_calls

本文探讨了Oracle数据库中的软解析概念及其与游标复用的关系。通过具体示例,分析了如何判断SQL语句是否进行了软解析,并解释了PARSE_CALLS字段的含义及其在软硬解析中的作用。
1 其实parse_call的过程是再获取游标的过程
2 一旦游标被cache到pga,无须再重新获取,自然是不用re-parse了 这既是软软解析了
3 而这游标是否在pga里共享,都会在v$open_cursor视图里展现的

4 隐士和显示游标我还没有理

我确信 你这个是软软解析
父游标文本 已然是第一次硬了,后2次cache 后 不用再重新获取游标,而是从cache中重用即可
再者,每个值按照邦德来处理,所以我确信邦德没有pink,你的执行计划就在第一次执行时已然确定,并在
随后的2次执行反复重用的就是这个执行计划,所以你的后两次是软软解析,无需再重新获取游标,即使硬的被记录展现到v¥sql的parse call中的1,而不是3,但此时图中字段excuse执行去记录为3的缘故

 
=============
declare
v_name varchar2(10);
cursor x is select last_name from employees;
i number(10);
begin
open x;
for i in 1..3 loop
fetch x into v_name;
delete employees where last_name=v_name;
end loop;
close x;
end;

然后看了下PARSE_CALLS 这个字段,以前我的理解是软硬解析之和。如果这个这里应该是3,但是是1

SQL> select SQL_TEXT,PARSE_CALLS,EXECUTIONS from v$sql where SQL_ID='49s3t6bm6yfj9';

SQL_TEXT PARSE_CALLS EXECUTIONS
-------------------------------------------------------------------------------- ----------- ----------
DELETE EMPLOYEES WHERE LAST_NAME=:B1 1 3
难道这里是硬解析?或者是我的语句是软软解析?怎么查看我这个 SQL是否进行了软软解析 v$open_cursor ?

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13750068/viewspace-731427/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/13750068/viewspace-731427/

import json import os from typing import Dict, List, Optional from openai import AzureOpenAI from mem0.configs.llms.base import BaseLlmConfig from mem0.llms.base import LLMBase from mem0.memory.utils import extract_json class AzureOpenAILLM(LLMBase): def __init__(self, config: Optional[BaseLlmConfig] = None): super().__init__(config) # Model name should match the custom deployment name chosen for it. if not self.config.model: self.config.model = "gpt-4o" api_key = self.config.azure_kwargs.api_key or os.getenv("LLM_AZURE_OPENAI_API_KEY") azure_deployment = self.config.azure_kwargs.azure_deployment or os.getenv("LLM_AZURE_DEPLOYMENT") azure_endpoint = self.config.azure_kwargs.azure_endpoint or os.getenv("LLM_AZURE_ENDPOINT") api_version = self.config.azure_kwargs.api_version or os.getenv("LLM_AZURE_API_VERSION") default_headers = self.config.azure_kwargs.default_headers self.client = AzureOpenAI( azure_deployment=azure_deployment, azure_endpoint=azure_endpoint, api_version=api_version, api_key=api_key, http_client=self.config.http_client, default_headers=default_headers, ) def _parse_response(self, response, tools): """ Process the response based on whether tools are used or not. Args: response: The raw response from API. tools: The list of tools provided in the request. Returns: str or dict: The processed response. """ if tools: processed_response = { "content": response.choices[0].message.content, "tool_calls": [], } if response.choices[0].message.tool_calls: for tool_call in response.choices[0].message.tool_calls: processed_response["tool_calls"].append( { "name": tool_call.function.name, "arguments": json.loads(extract_json(tool_call.function.arguments)), } ) return processed_response else: return response.choices[0].message.content def generate_response( self, messages: List[Dict[str, str]], response_format=None, tools: Optional[List[Dict]] = None, tool_choice: str = "auto", ): """ Generate a response based on the given messages using Azure OpenAI. Args: messages (list): List of message dicts containing 'role' and 'content'. response_format (str or object, optional): Format of the response. Defaults to "text". tools (list, optional): List of tools that the model can call. Defaults to None. tool_choice (str, optional): Tool choice method. Defaults to "auto". Returns: str: The generated response. """ common_params = { "model": self.config.model, "messages": messages, } if self.config.model in {"o3-mini", "o1-preview", "o1"}: params = common_params else: params = { **common_params, "temperature": self.config.temperature, "max_tokens": self.config.max_tokens, "top_p": self.config.top_p, } if response_format: params["response_format"] = response_format if tools: # TODO: Remove tools if no issues found with new memory addition logic params["tools"] = tools params["tool_choice"] = tool_choice response = self.client.chat.completions.create(**params) return self._parse_response(response, tools) 帮我按照上述思路分析一下
最新发布
07-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值