Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





(View) Performance


I have a huge table with product data from different shops in my database. There is a flag column 'import' witch flagt products with 1 for my PHP script.

To select from one shop all product individually, work with it, and then update these product import flag to 0 in the database, seems to be the slowest way. I thougt about a view about all products of a shop with flag '1'. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Large Table Performance Problem With MYSQL Performance
I am doing some benchmarking of an application using MYSQL under Windows and I confused about the results.

Environment
Emachine 6417 with amd3200+ 64 bit processor 3.3GB ram

mysql 4.1 with odbc 3.51 MYISAM
windows 2003 server std edition
date, account and invoice number are indexed
Database size 18 million rows

I am querying (selecting) columns of a date and an account

our tester program that opens a socket to the Mysql database and does a select for the above n times
each time the date and the account is randomized to minimize hits on records closeby.
This program will perform over 1000 queries per second.
At the end, the Mysql socket will be closed
Even when the socket is closed each time, I still get 400 queries per second.

When I enter a similar query manually a web interface, I get about 3-9 second response time. This program opens/closes a socket for each query when using EMS I get similar 9 second results.

Does anyone have any suggestions Also in production, this table will be accesse for both read and write will I have problems. My testing showed that Innodb is much slower.

View Replies !
Join On A View Without The View
I was wondering what the syntax would be to have a left join from one table to a resulting query without the view. Currently I use a view and it works fine but I was wondering how to achieve this without creating the view.

Here is the current view's SQL statement ( without the create view etc)...

View Replies !
Using A View
I want to use a view but I'm unsure how exactly MySQL handles a view and I can't seem to find anything about it in the docs. I guess my question is:

Is a view stored as a physical table or is it stored in memory or what? I'm asking because I want to make sure that if it is stored in memory that the amount of ram on my db server doesn't become an issue.

View Replies !
What Is A VIEW?
What is a VIEW?

Why when I go to chapter 23 does it tell me how to create, alter, and drop a view, but it doesn't say what it is or what they're used for? Maybe I missed it, but is there any place in the reference where a sentence starts, "A VIEW is...".

The closest I've come (looking outside of MySQL site) is a view is 'a predefined join of specified tables'.

I take that to mean it is essentially a shortcut to a specific data set relationship and based on that I can see how it is useful, but why isn't this concept defined in the manual? Is it really so obvious that it doesn't require any explanation, or god forbid a demonstration of how it is used?

Even more evidence that this is a stupid question is that when I google 'what is a mysql view' I get bounced back to the reference.

View Replies !
Is This Possible With A View?
I'm trying to cut down on the size of my database so I've changed it so that rather than implicitly setting every value in one table, I've split the data into two tables: one table (iData) contains data for the start of evey week:
iData
-----------------------------
2000-01-01 Volume: 20000000
2000-01-06 Volume: 30000000
2000-01-11 Volume: 40000000
Another table (jData) contains the delta (difference) from the previous iData entry:
jData
-----------------------------
2000-01-02 Volume: 1
2000-01-03 Volume: -2
2000-01-04 Volume: 1
2000-01-05 Volume: 3
2000-01-07 Volume: 2
2000-01-08 Volume: -5
2000-01-09 Volume: 6
2000-01-10 Volume: 1
2000-01-12 Volume: 2
2000-01-13 Volume: -4
2000-01-14 Volume: 4
2000-01-15 Volume: 3

Obviously this will save a lot of space as the delta is much smaller than storing the exact value (standard compression technique).

So what I would like to do is create a view to automatically display all of the data as if it were all stored in one table:

All Data:
---------
2000-01-01 Volume: 20000000
2000-01-02 Volume: 20000001
2000-01-03 Volume: 19999999
2000-01-04 Volume: 20000000
2000-01-05 Volume: 20000003
2000-01-06 Volume: 30000000
2000-01-07 Volume: 30000002
2000-01-08 Volume: 29999997
2000-01-09 Volume: 30000003
2000-01-10 Volume: 30000004
2000-01-11 Volume: 40000000
2000-01-12 Volume: 40000002
2000-01-13 Volume: 39999998
2000-01-14 Volume: 40000002
2000-01-15 Volume: 40000005

I know I can do this programatically, but is it possible to do this with a view? Any pointers would be much appreciated.



View Replies !
View With Parameters
can I put parameters into a view?

example

CREATE VIEW `dmz_sms`.`vwProva` AS
SELECT * FROM tb_sms where id=@ID;

I get error 1351.

View Replies !
View Schema
is there a tool to view a schematic of a MySQL DB I don't mean the .sql file I mean a pretty chart type schematic.

View Replies !
VIEW In MySQL
select NO_RESPONSABLE, NOM + PRENOM as NAME from RESPONSABLE

Gives me the number of the ID, but also "0" as the result of the
concatenated NAME.

View Replies !
Mysqldump View
I try to dump the view definition and records using the following command.

mysqldump -uroot -psecret! --databases test --tables proxy_view > mytest.txt

What all I get is the view definition without records. What is the correct method of dumping a view?

View Replies !
View Dependencies
When creating a view, it will (almost certainly) take information from one or more existing tables/views in the database. If I come to the database with no knowledge about the view (other than its name), how can I determine which underlying tables it depends on?

(I can do this is PostgreSQL by performing queries against the pg_class & pg_depends internal tables but I haven't discovered any way of doing it in MySQL either with SQL queries or with the C API.

View Replies !
Exponential View
how to store numbers in exponential view to MySQL. E.g. 4,56e-9 = 0,00000000456

I have 4,56e-9 as a variable in perl and want to store it to MySQL. Decimal as typ seems not to work. Does i realy have to convert it to 0,00000000456?

View Replies !
VIEW Problem
I create the next view:

CREATE VIEW VideoDB.FindCustomer AS
SELECT id, last_name&' '&name&' '&initial AS cname, picture, birthday, birthday_already, account_type, rents, exp_date, deposit, exp_deposit, auto1, kinship1, auto2, kinship2,
auto3, kinship3, auto4, kinship4, auto5, kinship5, auto6, kinship6
FROM VideoDB.customers;

When I execute the next statement the result is 0:
select cname from videodb.findcustomer;

How can I concat the whole name.
last_name&' '&name&' '&initial AS cname

View Replies !
View Foreign Key
My problem is that after creating a foreign key, I cannot see in MySQL/phpMyAdmin that a column is a foreign key, here is an example of 2 tables (I wanted to create a table with users in a community an create a table=relationship which contains the information about which users know each other):

CREATE TABLE `user` (
`id` double NOT NULL auto_increment,
`security_code` varchar(50) NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
);

CREATE TABLE `knows` (
`user_id_1` double NOT NULL,
`user_id_2` double NOT NULL,
KEY `benutzer_id_1` (`benutzer_id_1`),
KEY `benutzer_id_2` (`benutzer_id_2`)
);

Now ... after creating (using the ALTER command of MySQL) two foreign keys (linking 'knows' with 'user') in the 'knows' database (which are of course 'user_id_1' and 'user_id_2') I cannot see any changes on my tables in phpMyAdmin. Why? After using the export function of phpMyAdmin, there is nothing about the foreign keys in the generated SQL. Why?
And another question concerning the relationship 'knows', would you give me some idea about how to create it in DBDesigner 4 or Workbench? There is something that I do not understand:
In school we learned a lot about ERM. And in ERM you were able to define attributes for relationships (for example 'date' for table 'knows', which would inform me about when we have added the info). In DBDesigner a relationship can only be made as a connection between Entities, but without any attributes. And how would I define such recursive relationship like 'knows' (from above) in DBDesigner 4 then, so that the tool would add to the relationships foreign keys automatically and export the relationship 'knows' as a table later on?

View Replies !
SQL Source For A View
How do you obtain the SQL source that created a View?

I can Describe the view, but that doesn't give me the SQL that created it.

. . .

I should have searched the forums a little longer. The answer lies in the

SHOW CREATE VIEW viewName statement.

View Replies !
If Condition In View
Basically i want to add put a where condition in a view if the user variable '@org_id' is > 0. Here is some pseudo code:

CREATE VIEW view_students AS
SELECT *
FROM students
If (@org_id > 0) THEN
WHERE org_id = @org_id
END IF

I've tried lots of different approaches but i just cant figure out how to do it.

View Replies !
View Optimization
In my database I have separate four tables and from that four tables i have created one view. Each of the table contains round five lacs of records. So when view gives result it is approximately around fifteen lacs of records,

When I call that view like "select * from MyView where name='vimal'" it takes too long to give me result. And due to this one query my application server load increases by 80%. When I execute this view that time mysql Memory consumption is approximately 80% of total memory. What I can do to optimize the same? What are the other alternatives?

View Replies !
Can't View Tables
I have a table located in the following directory. C:ProgramFilesMysqlDataRecipesTablesshirt.sql
The Database is Recipes and within that Database is another Database called Tables that has several tables I just used the shirt table as an example. How do I get to this table?

View Replies !
Create A View
I have a master table and five detail tables. Now I want to have an overwiew on all detail tables that are related to the master table. The problem is that there are to many repeated records.

My wish is that to have each record of detail table in a single row with master table information in the view table. I tried to reach this with joins (left or right). No chance.. Code:

View Replies !
Creating A VIEW Using Php
$query="CREATE VIEW test AS SELECT option_price.option_id,plan_id,name FROM option_name,option_price WHERE (option_name.option_id = option_price.option_id) ORDER by option_name.option_id ";
$results = mysql_query($query);

View Replies !
Can't Create View
I am using MySQL 5.0.0 server Alpha release. Though the manual suggests that views on tables can be created in this version but i am unable to do so.

I have a table named 'ads'.
I am creating a view named 'test' with following syntax..
create view Test as select * from ads;

Msg returned by MySql is:
[MySQL] ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'view Test as select * from ads' at line 1.

View Replies !
Auto_Increment In A View
I have a table that is in no particular order, I would like to organize it in a view by ordering it and creating a new auto_increment field. Is this possible?

I used to just create a new ordered table and then alter it with a auto_increment field but that takes too much time.

Is there any other better solution to this?

View Replies !
Create View
I currently have a script that I have developed on a MS SQL server. As part of it I use a VIEW to do most of my lookups. I want to transfer it to a MYSql DB, but when I try and CREATE VIEW I get the following message....


mysql> create table t (qty INT, price INT);
mysal> insert into t values (3, 50);
mysql> create view v as select qty from t;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near 'view testv a
s select qty from t' at line 1
mysql>

I am using MYSQL for Netware. I am using an example that I have found to demostrate it, but it just does not work.

View Replies !
UPDATEABLE VIEW
I am getting an error when updating a table from a view in MySQL 5.
I have created a view & then reference it in my update command, by MySQL caomes back with an unknown table error.

I can 'show' & 'describe' the view, so it is definately there.

View Replies !
How To View All The Sp Created?
is there a way to view all the stored procedure created in mysql? a command to view all avaialble sp's?

View Replies !
Currency View
When displaying product prices in MySQL database its only showing 17.5 instead of 17.50. Tried different things in Excel to make the view display correctly, but had no luck. Any ideas?????

View Replies !
View The TimeStamp
I know you can view when a table was updated in mySQL Administrator. Is there a way in SQL to view that TimeStamp?

View Replies !
View SQL Files
I am about to by the content of a site, but it is in sql files. I need to view this content and extract to make a new site from it in html format.

How do I view SQL files and extract it content? Is there any program that does it?

View Replies !
Can I View .frm, .MYD And .MYI Files?
At my current host, the server crashed and all data seemed to be lost. Lucky for us they had had a backup of all data which they put back on the server.

But now I get errors with some tables in phpMyAdmin where they show up as "in use" and when I view them I get the following error:

MySQL
#1033 - Incorrect information in file: *.frm
or

MySQL
#1016 - Can't open file: '*.InnoDB'. (errno: 1)

Because of the issues, they send me the *.frm, *.MYD and *.MYI files.
But am I able to view these files to see the structure or data?
And can I verify if structure or data is corrupt?

View Replies !
How To View Catalog In MySQL
How can I query mysql to view the catalog? (By the catalog I mean the
special internal database that holds the meta-information about all
other databases in the system, including descriptions of all the tables
and their fields.) I know how to do this in psql, so I imagine there
is a similar facility in mysql. FWIW, my OS is Linux.

View Replies !
Create View Statements
I've read the help page on the mysql.org site but still cannot get

create view employee as select emp.name from emp, dept where
dept.id=emp.dept;

The select statement works fine on its own and I've changed the view name
a couple of times to avoid reserved words but still get Error 1064 : you
have an error in your sql syntax near... which leaves me none the wiser.

View Replies !
Creating Table View
I had a table called 'FruitSaleList', that contains the following columns

sl.no, shop_id, fruitName, price, ....

I had also another table called 'FruitList' that contains the columns

shop_id, fruitName, salesManId, ....

is 'FruitList' table doesn't contain a column like fruitId.

Let us assume there are following fruits are available in all shops

Apple

Banana

Cherry

Dates

Elderberry

Figs

Grapes

Jackfruit

Orange

(it is a lengthy list, around 50)

In some case I need to list the details of fruits after 'Grapes' from 'FruitSaleList'. That means I have to list the 'Jackfruit' and 'Orange' from 'FruitSaleList'.

I'm struggling to list these using a MySQL query in php.

If I create a table view(FruitDetails) like below then I will proceed as specified below

|FruitId|FruitName|

|1 |Apple |

|2 |Banana |

|3 |Cherry |

|4 |Dates |

|5 |Elderberry|

|6 |Figs |

|7 |Grapes |

|8 |Jackfruit |

|9 |Orange |

View Replies !
Add New Colums To Existing View
Is it possible to add new column to existing view? For example:
let us have three tables:

table1 with columns(c1,c2 ,c3 )
table2 with columns (cc1,cc2, cc3)
table3 with columns(ccc1,ccc2)

we have a view "View1" with columns say c1, cc1. Now is it possible to add new column ccc2 to the existing view "View1"

View Replies !
View Slow Query Log
I searched here, google and MySQL docs but did not find an answer.
I'm using MySQL-Front from a Windows platform to administer a remote database. The remote server doesn't have phpMyAdmin or anything like that.
MySQL-Front reports 133 Slow Queries and an average of 15 queries per second. But I dont' know how get more information than that.

View Replies !
MySQL View Schema
If there's a MySQL command to view the schema of all the tables in a database.

View Replies !
Slow View Queries
I have a fairly complex view which, when you execute a SELECT * shows all info very quickly (0.24 seconds to return nearly 3000 rows). However, when I start throwing slightly more complex queries at it, things really slow down - an average query can take 40 seconds to execute.

View Replies !
View Tables Structure
I can't browse them or view structure because it comes up with an error

#1033 - Incorrect information in file: './smtcg/cards.frm'

Currently there are 12 tables with the same error, all of the tables are InnoDB

View Replies !
View User Permissions
Is there a way to query MySQL to find out what the permissions of the user currently connected
For Example:
Database: customer_contacts
User : cust1
Table: Archives
User Permissions: Read Only(SELECT).

Is there a way to ask MySQL what User cust1 can do?

View Replies !
Convert Access View
I am finding software that can convert "Microsoft Access View/Queries" to "MySQL View". Anyone know?

View Replies !
Creating A View From Two Tables
I have two tables, tblBooks and tblPubCodes, what i need is this..

The table tblBooks has a field in it with a two letter code such as AB it also contains other feilds such as BookID and Title. The second table tblPubCodes, has a simple list that contains the two letter code and what it means i.e. Field 1 is ID, Field 2 is AB and field 3 is ABINGDON.

I need a view i think to create a tbl that contains the BookID, Title, and the Meaning of the two letter code.

View Replies !
Creating A View For Duplicates?
I have a bit of a large database (2 million rows -- going to be around 10-12 million later), and I was wondering how to create a view that does the following:

turning THIS:
id | attribute | value
---|-----------|------
1 name joe
2 name bob
3 name paul
4 name joe
5 name paul
6 name jones
7 age 12

into THIS:

id | attribute | value | occur
---|-----------|-------|-------
1 name joe 2
2 name bob 1
3 name paul 2
6 name jones 1
7 age 12 1
the id field's values don't really matter to me except that they remain unique (the original table's id field is the primary key & auto_increments).

View Replies !
How To Create A View Using Mysql 4.1?
how to create a view using mysql 4.1?

View Replies !
MySQL View For A DB2 Database
I want to create a view in MYSQL, but the database/table is in a DB2 database. Is it possible ? I have heard that such a thing is possible between say ORACLE and SQL Server.

Bottom line, my tables are there in DB2, and i want to create a view in MySQL database. The reason of doing this is that i'm using Ruby/RubyonRails on AIX platform, since i could not find a DB2 Driver on AIX for RAILS, i want to go for this indirect approach.

(Rails works fine with MySQL). hence from Rails i want to access the MySQL (Indirectly to DB2)

View Replies !
Show View Denied
I can create views and access them in coldfusion queries. I can not re-access them to edit or delete them.

View Replies !
How To Add Auto_Increment Column Into VIEW ?
Is it possible to add in VIEW an AUTO_INCREMENT column like in MSSql ?

AUTO_INCREMENT column in table does not suite in my case..

View Replies !
Illegal Mix Of Collations For A View
i've created a view from a select statement which executes fine, but when i try to select from the view, i get the error:

ERROR 1267 (HY000): Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='

i have tried to change all the charset variables to 'utf8' and all the collation variables to 'utf8_unicode_ci' and alter all the tables collation (ive checked using "show table status" but i still get the error, all data is ASCII in all tables !

View Replies !
CREATE VIEW Statement
I'm trying to create a table view that will show the current day number of unique IP addresses taking into account previous days. For example, if the IP was logged yesterday or the week before I want to exclude it from todays count. I have a table logging item, ip, UNIX date. I can easily get total unique counts but have no idea how to do a current day count and exclude IPs from previous days.

View Replies !
Can't View Query Error Log
I've just started developing with MySQL.

I'm using the XAMPP Server. (which comes with an installation on PHP, MYSQL, Apache ).

Can someone tell me where to look for the queries that the mysql runs. I looked in the data directory and I can see the .err file but I don't see a Query log file in it. I even tried adding an log="C:/mysql.log" statement to the my.cnf file in MySQL and restarted but still didn't see anything.

I need to trace any sql query errors and so need to see the query log and the error messages.

View Replies !
Optimal Way To Log View Counts
We are running into issues when trying to log the number of times a page has been viewed on our website due to recent large increase in traffic. The psuedo-code for every pageview on the site is

INSERT INTO pageview (pageid,date)
UPDATE page SET viewcount = (SELECT COUNT(*) FROM pageview WHERE pageid = page.id)

This is causing us locking issues because the 'page' table is very heavily selected from.

I realise that the subquery in the UPDATE statement above could be replaced with a simple 'viewcount = viewcount + 1' but we've had issues where this count has drifted out of sync.

What's the best practice way of doing this? Would it be worth moving the viewcount column into a separate table to try and prevent the locking?

View Replies !
View Insertion Failing
I am trying to insert into a view named 'request_files_v'. I get the error

"SQLSTATE[HY000]: General error: 1471 The target table request_files_v of the INSERT is not insertable-into".

I am giving the insert command from the same userid that had been used to define the view. Also, in information_schema.VIEWS, I see that the 'IS_UPDATABLE' field for this view is 'YES'.

What could be the possible reason I am not able to insert into this view?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved