We created so many inefficient stored procedure in our application, we always postpone to make it more efficient until we have serious problem with database performance.
Now, I am thinking to fix it one by one order by most often executed stored procedure.
What is the best way to figure out which stored procedure is the most executed?
...
When I do:
$q = 'insert into movies values("lion king"); select * from movies;';
$result = $db->query($q);
echo mysqli_num_rows($result);
it says that $result is boolean, not mysqli result.
if I check $result like this:
if(!$result) echo 'fail';
it outputs 'fail'.
Is mysql not capable of handling more than 1 query at a time? How d...
I have a MySQL database with the following table structure:
TransactionType: Transaction_Amount, Transaction_ID, Transaction_Form
Transaction: Transaction_ID, Timestamp
Purchase: Transaction_ID, Item_ID
Items: Item_ID, Client_ID
This is really a two part question (please let me know if i should post these as two separate questions)
1)...
I get the above error in my C#/SQL/ASP.NET app because I have a datasource defined both in the ASPX file and the ASPX.CS file. But I want the Gridview to have selectable rows. So if I comment out the ASPX.CS datasource I get the above error but if I comment out the ASPX datasource I get the Gridview output but it is not selectable. Ho...
I have a database field of type time with time zone. How can I query this field in EST5EDT time zone with the output format hh:mm:ss?
All I can find is using multiple calls to EXTRACT:
SELECT EXTRACT(HOUR FROM TIME WITH TIME ZONE '20:38:40-07' AT TIME ZONE 'EST5EDT');
[Edit:]
To be clear, this query:
SELECT TIME WITH TIME ZONE '...
Hello, I've discovered something pretty amazing that works recently. I am wanting to know if it is "correct" and if it should work "everywhere." (as, it's not just a coincidence and it's supported as some sort of standard)
Well, I can have code like this...
IDbCommand cmd=new ....; //this changes depending on if I'm using Sql Server or...
It appears that there is a limit of 1000 arguments in an Oracle SQL. I ran into this when generating queries such as....
select * from orders where user_id IN(large list of ids over 1000)
My workaround is to create a temporary table, insert the user ids into that first instead of issuing a query via JDBC that has a giant list of para...
I have around 100thousand rows in a mysql table, where each row has about 8 fields.
I have finally got the hold on how to use Zend Lucene to index and search data from a mysql table.
Before I fully implement this funcionality to my website, I have some questions:
1- Is it possible to determine the size of a index in advance? This beca...
I have associated two models Businesses and Ratings. A business can be rated many times, and each rating stores an integer from 0 to 5.
I would like to create a "Hall of Fame" page, where I list the top 10 businesses, by sorting businesses based on average ratings (which would use the Ratings model) and limiting the results to 10.
I'm ...
SELECT *
FROM (SELECT ROWNUM rnum,
query.*
FROM (WITH myQuery AS(
SELECT column_b
FROM table_a a
WHERE a.column_a = 1234)
SELECT b.column_e AS some_column
FROM table_b b,
table_c c,
table_a a
...
echo $totalprice;
echo "<br/>";
echo $shortfall;
echo "<br/>";
echo $unitprice;
echo "<br/>";
I got
24 80
0.3
Then the following command was executed.
// update query
However, only
total_price
was changed(became 0.00) while other values like
unit_price
stay unchanged. But other values like
unit_price
sh...
If it matters as of now I'm using
MySQL/MyISAM but I'm open to using
PostgreSQL. I'm also open to using memcached.
Consider a table that's used to store forum threads:
id forum_name post_date
1 Hey! 2009-01-01 12:00:00
What's the best practice of storing thread-related entities such as votes, views, and counters?
S...
Hoping someone can help with this. I have a query that pulls data from a PHP application and turns it into a view for use in a Ruby on Rails application. The PHP app's table is an E-A-V style table, with the following business rules:
Given fields: First Name, Last Name, Email Address, Phone Number and Mobile Phone Carrier:
Each pro...
Hello,
Actually the problem arises since we have named a column "authorization" which is ok on mysql but fails miserably on postgres - "authorization" is a reserved keyword there.
We want to have all schemas in sync even on different databases, so we want to rename "authorization" in the mysql catalogue(s) to something neutral.
It wo...
I have 3 tables:
Vehicle: vehicle_id, vehicle_type
1, motorcycle
2, car
3, van
Owners: person_id, vehicle_id, date_bought
1, 1, 2009
1, 2, 2008
2, 3, 2009
2, 1, 2005
I want to display a list of all vehicle names. If the person_id = 1, date_bought should also be returned.
So I thought I would start with this:
SELECT * FROM vehicles
...
how do i get current system time stamp in SQL Server.
...
I need to create an SQL formatter in C#. Could anyone point me to some resources on the net? Do I need to implement a full-fledged parser, or is there an easier way to do it?
...
I am using ASP.NET 2.0 with SQL Server 2005.
My page have a text box where TextMode="MultiLine"......see below
Now when I save this text in my database of course it does not save it with any HTML tags, and thus when i read that value from the database it comes back as 1 line such as....
Hello word, It needs to look like this. Tha...
How do I call a stored procedure from a web service method without having to wait for the stored procedure to finish, and just let the method finish all other activities?
As an example (not actual situation but much simpler to understand):
I have a table houses with 10 million rows, and each year I have to calculate what each house is ...
I have a simple table
CREATE TABLE a(
id int IDENTITY(1,1) NOT NULL,
x varchar(50)
)
I found that following query works
select cast (id as varchar(3))+cast (x as varchar(3)) c from a
where cast (id as varchar(3))+cast (x as varchar(3))='1a'
but this does not work
select cast (id as varchar(3))+cast (x as varchar(3)) c...